发送邮件时发生错误..无法验证密码。错误:535-5.7.8用户名和密码不被接受。了解详情,请访问535 5.7.8 https://support.google.com/mail/?p=BadCredentials d190sm18198379pgc.53 - gsmtp 无法使用PHP SMTP发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。电子邮件不发送代码错误
<?php
public function sendmail()
{
if($this->input->post()){
$email=$this->input->post('email');
$config = Array(
'protocol' => 'smtp',
'mailtype' => 'html',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => '465',
'smtp_user' => '[email protected]',
'smtp_pass' => 'xxxxxxx',
'useragent' => 'CodeIgniter',
'crlf' => '\r\n',
'newline' => '\r\n'
);
$this->load->library('email', $config);
$this->load->library('email');
$password="<p>This email has been sent as a request to reset our password</p>";
$from='[email protected]';
$to=$email;
$subject='forget password';
$this->email->from($from);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($password);
if($this->email->send()){
$this->session->set_flashdata('email','We sent your password to your Email...!');
}
else{
echo $this->email->print_debugger();
}
}
else{
$this->load->view('adminlogin');
}
}
您的错误消息表明智能的东西,如*“用户名和密码不被接受”*,特别是*“了解更多http:// thissuperinformativepage”*。您是否尝试过阅读该错误并关注该链接? – GolezTrol
顺便说一句:在网上分享您的凭据很好。这显然是你永远不应该做的事!我会尽快更改它们! - **我的意思是**的实际密码,因为即使您进行了编辑,问题的历史记录仍会保留在那里。 – GolezTrol
''crlf'=>'\ r \ n',//应该是“\ r \ n”' - 这意味着,您应该学习一些基础知识。 http://php.net/manual/en/language.types.string.php#language.types.string.syntax.double – CBroe