Skip to content

Latest commit

 

History

History
38 lines (16 loc) · 646 Bytes

README.md

File metadata and controls

38 lines (16 loc) · 646 Bytes

Nodemailer for Gmail

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

CLIENT_ID

CLIENT_SECRET

USER

REFRESH_TOKEN

Here, I have used config.js file for these variables.

Explanation

  1. Create your own client with your credentials and set refreshtoken to identify the Oauth user.
  2. You can get the access_token from the OAuth2_client.
 const access_token = await OAuth2_client.getAccessToken()
  1. Now create a transporter for the mail with the required details.
  2. Create your message using documentation and send it. Bass!!!