Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deepak-cotocus/9d0aea817ed4bce05cf11413ae8b4781 to your computer and use it in GitHub Desktop.
Save deepak-cotocus/9d0aea817ed4bce05cf11413ae8b4781 to your computer and use it in GitHub Desktop.
Gmail Email server set up for Laravel App

When do we need this Configuration?

Ans- When we have to Configure Gmail SMTP Server in Laravel Application

Our .env file looks like this after Configuration:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=ENTER_YOUR_EMAIL_ADDRESS(GMAIL)
MAIL_PASSWORD=ENTER_YOUR_GMAIL_PASSWORD
MAIL_ENCRYPTION=tls
  • Since we are using Gmail SMTP, we need to change some security settings on our Google account, to give access to less secured applications and we need to generate App password and mention it to .env file as MAIL_PASSWORD of Laravel app

Steps

1.Login to your Google Email Account and click on Google Account Button. This button is display when you click on the profile picture in your Gmail Dashboard as shown.

alt text

2.Create & use App Passwords

  • Go to your Google Account.
  • On the left navigation panel, choose Security.
  • On the "Signing in to Google" panel, choose App Passwords. ...
  • At the bottom, choose Select app and choose the app you're using.
  • Choose Select device and choose the device you're using.
  • Choose Generate.
  • Follow the instructions to enter the App Password. The App Password is the 16-character code in the yellow bar on your device. Choose Done. alt text

Most of the time, you’ll only have to enter an App Password once per app or device, so don’t worry about memorizing it.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment