Saturday, 14 December 2019

php - Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted




I send mail using CodeIgniter, but it returns this error:




Failed to authenticate password. Error: 535-5.7.8 Username and
Password not accepted




Here is my code:




 $this->load->library('email');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 587,
'smtp_user' => 'my@gmail.com',
'smtp_pass' => 'mypass',
'mailtype' => 'html',
'charset' => 'iso-8859-1'

);
$this->load->library('email', $config);
$this->email->from('my@gmail.com');
$this->email->to('send@gmail.com');
$this->email->subject('This the test');
$this->email->message('this is the test message');
if (!$this->email->send())
{
echo $this->email->print_debugger();


}


I've configured my Xampp server using this question: How to configure XAMPP to send mail from localhost?


Answer



Change the smtp port to 465 if you are using ssl.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...