DEV Community

Indra Adnyana
Indra Adnyana

Posted on • Edited on

9 1 1 1 1

How To Set Up and Configure Gmail SMTP Server for Email Sending

  1. Go to your Google Account Settings or click this link
    https://myaccount.google.com
    Image description

  2. In the Security section, ensure that 2-Step Verification is turned On
    Image description

  3. Go to link https://myaccount.google.com/apppasswords, enter a name for the app password, and click Create
    Image description

  4. Copy the generated app password and click Done
    Image description

  5. Paste it into the MAIL_PASSWORD field in your .env file without spaces, For Example:

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=no.reply@gmail.com
MAIL_PASSWORD=xbxjfnxeseobslde
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no.reply@gmail.com
MAIL_FROM_NAME="${APP_NAME}"
Enter fullscreen mode Exit fullscreen mode

If you encounter an error, try replacing MAIL_PORT with one of the following:
25, 465, 587, or 2525.

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (2)

Collapse
 
madeinmilwaukee profile image
Chuck Watson

Is this language agnostic? Where is my env file? How does any of this work?

Collapse
 
mikec711g profile image
Michael Casile

Would like to know as well. Maybe a quick sample. I looked gmail env file and it still leaves me with questions.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more