php – Failed to authenticate password using codeigniter-ThrowExceptions

Exception or error:

Failed to authenticate password. Error: 534-5.7.14 Please log in via your web browser and then try again. 534-5.7.14 Learn more at 534 5.7.14 wv1sm5867206pab.37 – gsmtp

function index() {

     $config = Array(
       'protocol' => 'smtp',
       'smtp_host' => 'ssl://',
       'smtp_port' => 465,
       'smtp_user' => '',
       'smtp_pass' => '92135108845129',
       'mailtype' => 'html',
       'charset' => 'iso-8859-1',
       'wordwrap' => TRUE  


     $this->load->library('email', $config);
     $this->email->from('', 'Gaurav kwatra');
     $this->email->subject('This is an email test');
     $this->email->message('Emial Testing');


         echo 'Your email sent...!!!! ';
//end of code

I use above code to send mail from codeigniter….I have an error…Failed to authenticate. Password is correct.

How to solve:

You would need to go to your account settings and you would need to enable Access for less secure apps which helps to use the google smtp for clients.

Please have a look here too


If it still doesn’t work even after enabling less secure apps – you should login to your security area within your Google account and see if your device has been blocked. Google blocked my server so I then went to and it now allows me to send. Nothing to do with the username or password but Google blocking the device access.


One of the reason can be the cpanel settings. Please try:

  1. Login to CPanel
  2. Tweak Settings > All>
  3. “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)

And select “off”


Although it was a question five years ago, today I encountered the same situation and found the correct answer as a supplement.

All CI settings are correct, the only problem lies in Google ’s security settings, go to

And set Sign in using App Passwords, which can find options, select mail, and choose other in the options of the device, enter the name at will, such as PHP / CI, and then Google will generate a password for you to use.
Please replace the password you entered in the CI email with this password, cheers.

Leave a Reply

Your email address will not be published. Required fields are marked *