Reputation: 167
I know this question has been asked before. I have worked through the answers, but I'm still getting a 'Failed to authenticate password. Error: 535-5.7.8' error message. My code:
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => '********',
'mailtype' => 'text',
'charset' => 'iso-8859-1',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'My Name');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing Codeigniter E-mail Library.');
$this->email->send();
echo $this->email->print_debugger();
This returns the following error message:
220 smtp.googlemail.com ESMTP x64sm5635644wrb.10 - gsmtp
hello: 250-smtp.googlemail.com at your service, [89.238.188.204]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to authenticate password. Error: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials x64sm5635644wrb.10 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Thu, 18 May 2017 08:36:24 +0000
From: "My Name" <[email protected]>
Return-Path: <[email protected]>
To: [email protected]
Subject: =?ISO-8859-1?Q?=41=73=68=20=48=69=6E=69=6E=67=20=46=61=72=6D=20=45=6E=71?= =?ISO-8859-1?Q?=75=69=72=79?=
Reply-To: "[email protected]" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
I have checked the username and password for my google account and know that they are correct.
Upvotes: 3
Views: 4613
Reputation: 235
This is my experience.
Already enabled less secure apps
on my Google Account and successfully authenticated password using Codeigniter and Gmail. And after a few months of disuse I'm on the CI system again and it seems to fail to authenticate the password, be aware that Google will automatically disable
this setting when not in use. It's time for you to reactivate it.
Upvotes: 0
Reputation: 111
If you are using Google account
UPDATE: now you need to enable "less secure apps" on your Google Account
https://myaccount.google.com/lesssecureapps?pli=1
Upvotes: 1
Reputation: 2386
You would need to go to your account settings https://www.google.com/settings/security and you would need to enable Access for less secure apps
which helps to use the google smtp for clients.
May be this will help!!
Upvotes: 0