iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
✉️

How to send emails using Gmail SMTP settings

に公開

Introduction

In this article, I will explain the configuration method for sending emails from an application using Gmail.
While there are several free email servers available, I found it more convenient to easily set up Gmail when performing test transmissions, so I have compiled this as a memo for myself.

Settings

1. Set up 2-Step Verification

First, set up 2-Step Verification from Security.


Enable the 2-Step Verification process

2. Set up App Passwords

From the bottom of the 2-Step Verification page, click on "Create App Password >".
Any app name can be entered, then click "Create".

If the App Password option does not appear, please configure it from here while logged into your account.

3. Save the generated App Password

Copy and save the App Password.

4. Gmail SMTP settings method

By setting the following information in your environment variables, you can configure email sending using Gmail. Please add this information to your .env file.

Email Server smtp.gmail.com
Port Number 587
Sender Email Address Gmail email address
SMTP Username Username (the part to the left of the @ in your Gmail address)
Password The App Password you just saved

Conclusion

In this article, I introduced the setup procedures for sending emails from an application using Gmail.
Since Gmail is familiar to many and has a low barrier for environment setup, it is very convenient for testing purposes or small-scale applications.
I compiled this as a personal memorandum, but I hope it will be helpful to others setting up email transmission in similar situations.

References

https://doc.gravio.com/manuals/gravio4/1/ja/topic/gmail

Discussion