Laravel google smtp setup

Primary tabs

For this to work you would need also enabling in your google account "Less secure app access". It is under "My Account Page" and "Security". After this, edit .env file and add following:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=replaceme
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

The mail_username needs to be e-mail what you have in google. In password field define password what is defined in google mail.

PS! In case you have debug turned on in laravel .env, then turn it off. Otherwise google smtp credentials will leak



QR Code for https://setupexample.com/laravel-google-smtp-setup