I'm using this function to send email using my codeigniter project.
public function sendMail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => 'xxxxx@gmail.com',
'smtp_pass' => 'xxxxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = 'test message';
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('waaanjula@gmail.com');
$this->email->to('waaanjula@gmail.com');
$this->email->subject('Your Subject');
$this->email->message($message);
if($this->email->send())
{
echo 'Email sent.';
}
else
{
show_error($this->email->print_debugger());
}
}
but it gives "Failed to authenticate password. Error: 534-5.7.14" can any one please advice on this
我认为配置是可以的,如果您确定电子邮件和密码,那么它一定是Gmail的新安全策略,它们会阻止应用程序使用您的帐户,为此, 请转到此页面并按照说明进行操作。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.