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?