Home > Net >  Gmail smtp not working with only one email
Gmail smtp not working with only one email

Time:08-29

I am using gmail smtp in my laravel, It was working fine till yesterday but it suddenly stopped, I am getting this error

Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted

Less secure apps was already on so i added 2 factor auth and created an app password but still not working, I created a test email and it worked fine, why is not working with my first email

This is my setting in env

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com 
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
[email protected]

I also tried by adding double quotes, but still not wokring, Can anyone please help

CodePudding user response:

After the removal of less secure apps. You can no longer connect to googles smtp server using the actual password of the users gmail account.

YOu have two options.

  1. enable 2fa on the google account and create an apps password. The apps password can then be used in place of the password in your code.
  2. Switch to using Xoauth2.

CodePudding user response:

Google recently removed simple SMTP authentication considering the method as fragile from a security point of view.

Having to enable the "Application password" or Xoauth2

  • Related