0

I have used application-specific password for my Gmail account to send emails since other way does not work in my server environment though it works in local. my configuration is as follows

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=testss@gmail.com
MAIL_PASSWORD=app=pwd-from-gmail
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=testss@gmail.com
MAIL_FROM_NAME="testy"

but i get following error in the local environment also now.

Swift_TransportException: Failed to authenticate on SMTP server with username "testss@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "534", with message "534-5.7.9 Application-specific password required. Learn more at
534 5.7.9  https://support.google.com/mail/?p=InvalidSecondFactor k14sm3626375pfh.154 - gsmtp

How do I fix this issue?

userDuR
  • 101
  • 3

1 Answers1

0

I couldn't solve this issue using app password. However I solved it in other way by following steps.

  1. Disabled two factor authentication
  2. Enabled less secure app
  3. Logged in to the gmail account from a browser in the server.
  4. Changed the app password to account password in the .env file

Now it works that way. I even checked this after signing out from the gmail account from the server browser. It works. It seems like they just need to verify the device. If I move this to another server, then I have to re-login. That is problem I encounter now.

userDuR
  • 101
  • 3