I\'m trying to set up email for my first laravel project, and was thrilled that there\'s a laracast for it: https://laracasts.com/lessons/mailers
I\'ve followed the
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
MAIL_USERNAME=yourgmailid@gmail.com
MAIL_PASSWORD=generatedAppPassword
MAIL_ENCRYPTION=tls
If you still get this error when sending email: "Failed to authenticate on SMTP server with username "youremail@gmail.com" 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.
If you still get this error when sending email: "Failed to authenticate on SMTP server with username "example@gmail.com" 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.
Use double quote for your password: like - "Abc@%$67eSDu"
This is how I solved this issue:
Change the .env file as follow
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=587
MAIL_USERNAME=email_address@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
And the go to the gmail security section ->Allow Less secure app access
Then run
php artisan config:clear
Refresh the site
I had the same problem and I've already tried everything and nothing seemed to work until I just changed the 'host' value in config.php to:
'host' => env('smtp.mailtrap.io'),
When I changed that it worked nicely, somehow it was using the default host " smtp.mailtrap.org" and ignoring the .env variable I was setting.
After making some test I realize that if I placed the env variable in this order it would worked as it shoulded:
MAIL_HOST=smtp.mailtrap.io
MAIL_DRIVER=smtp
MAIL_PORT=2525
MAIL_USERNAME=xxxx
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=null