I am trying to setup emails in my Laravel aplication, I have my env file something like this:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls
I tried according to the answer given in this question Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted
I followed the steps, enabled 2 step verification, then created app password and configured my .env
file
Finally I did php artisan config:cache
Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code "534", with message "534-5.7.14
Please help me out with this. Thanks.
I had the same problem. It was the Captcha link that fixed the issue, even though I don't use it. It seems there is an additional step to allow new devices to open the gmail account.
https://support.google.com/mail/answer/7126229?visit_id=636865986363810933-1186759849&rd=1#cantsignin
I had already set up this below beforehand
Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account.
Steps to configure Gmail/Google SMTP with Laravel
.env
file setup
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=GMAIL_USERNAME
MAIL_PASSWORD=GMAIL_PASSWORD
MAIL_ENCRYPTION=ssl
Allow Less Secure Apps
Go to Google Accounts > Security > Allow less secure apps.
https://www.google.com/accounts/DisplayUnlockCaptcha
P.S. - If you have 2 step verification enabled, then Create app password and use that instead of GMAIL_PASSWORD
Reference - https://support.google.com/mail/answer/7126229
Need to create new
less secure
gmail account for configurationnot use in more than 3 projects
.
If you can't solve this with all the answers above, go to your account setting https://myaccount.google.com/security turn on two-step verification and generate an app password, this way will definitely work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With