Failed to authenticate on SMTP server error using gmail
Nothing wrong with your method, it's a G-mail security issue.
Login g-mail account settings.
Enable 2-step verification.
Generate app-password.
Use new-generated password in place of your real g-mail password.
Don't forget to clear cache.
php artisan config:cache.
php artisan config:clear.
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=generatedAppPassword
MAIL_ENCRYPTION=tls
If you still get this error when sending email: "Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators"
You may try one of these methods:
Go to https://accounts.google.com/UnlockCaptcha, click continue and unlock your account for access through other media/sites.
Using a double quote password: "your password" <-- this one also solved my problem.
This will not work as of May 30, 2022 checkout here https://support.google.com/accounts/answer/6010255?hl=en&authuser=6 Thanks @sarout for pointing this out.
Did you turn on the "Allow less secure apps" on? go to this link
https://myaccount.google.com/security#connectedapps
Take a look at the Sign-in & security -> Apps with account access menu.
You must turn the option "Allow less secure apps" ON.
If is still doesn't work try one of these:
Go to https://accounts.google.com/UnlockCaptcha , and click continue and unlock your account for access through other media/sites.
Use double quote in your password: "your password"
And change your .env file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=xxxxxx
MAIL_ENCRYPTION=tls
because the one's you have specified in the mail.php will only be used if the value is not available in the .env file.
I had the same issue, but when I ran the following command, it was ok:
php artisan config:cache