Use Google Mail Server in Laravel app

codestarch

Laravel

2025-06-15

Image

Another option for Mail Server is Gmail. Setting up is relatively easy.

To setup we need to create an App Password which allows us to use gmail server outside the google environment.

To create App Password;

  1. Go to https://myaccount.google.com/
  2. After successsiful login to your google account and search 'App password'
  3. Add App name and Password and create

Note the App password  

Then modify Mail server settings in the .env file

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com 
MAIL_PORT=587 
MAIL_USERNAME=your_gmail_account
MAIL_PASSWORD=your_App_Password
MAIL_ENCRYPTION=tls 
MAIL_FROM_ADDRESS="your_gmail_account"
MAIL_FROM_NAME="${APP_NAME}"

 Now you can use the gmail mail server to send emails in your project.

1 Comments

Image
j
0 Replies
james 8 months ago

you saved my life



Codestarch

Enjoy quick fix with our code snippets and complete projects templates.



Useful links

Your Account

Help


Contact

codestarch@gmail.com


©2026 Copyright: All rights reserved.