Gmail smtp not working with only one email

Viewed 57

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@gmail.com" 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
MAIL_USERNAME=email@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
MAIL_EMAIL_ADDRESS=email@gmail.com

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

1 Answers

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.
Related