DEV Community

Muhammad
Muhammad

Posted on

How to send email from my Node JS app using my Gmail account?

First, 3 methods exist in 2023:-

  1. Using the Less Secure App Option: (it was shutdown themselves by Google recently) Not Recommended
  2. Using App Passwords: In 2023, you can not use nodemailer with simple configuration since Google does not allow doing so and the smalll caveat of App passwords is not recommended either by me. Access it by clicking https://myaccount.google.com/u/2/apppasswords Not Recommended
  3. Using OAuth Recommended

Secondly, I will show the Google-recommended way of sending from you Node JS app an email using your Gmail account.

Step 1. Create a project in Google Cloud console
Step 2. Turn on Gmail API in "APIs and Services"
Step 3. Configure the "OAuth Consent Screen"
Step 4.

(still writing)

Top comments (1)

Collapse
 
steve-lebleu profile image
Steve Lebleu

I would like to respond and suggest this package: github.com/steve-lebleu/cliam

Cliam allows you to deal with SMTP and Web API quite easily.