Send emails using Gmail in Laravel 5


Troubleshoot with Gmail and Laravel. Why can't send mails with Gmail account, and what we have to change in Gmail settings in order to work with Laravel!

First, go to:

https://myaccount.google.com/security#connectedapps

Take a look at the Sign-in & security -> Connected apps & sites -> Allow less secure apps settings.

You must turn the option "Allow less secure apps" ON.

Once complete, edit the .env file:

MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=yourEmail MAIL_PASSWORD=yourPassword MAIL_ENCRYPTION=tls

If you 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. First go to:

https://accounts.google.com/UnlockCaptcha Click continue and unlock your account for access through other media/sites.

And second method:

Using a double quote password: "your password"