How to use SendGrid with Nodemailer to send mails.

Step 1: Making an account and verifying a single sender.

Step 2: Integrating SendGrid SMTP with Nodemailer

Create Nodemailer transport

const nodemailer = require('nodemailer');const nodemailerSendgrid = require('nodemailer-sendgrid');const transport = nodemailer.createTransport(nodemailerSendgrid({     apiKey: process.env.SENDGRID_API_KEY  }));

Send a message

transport.sendMail({   from: 'xyz@gmail.com',   to: 'Receiver Name <receiver@example.com> ,        someother@example.com',  subject: 'hello world',  html: '<h1>Hello world!</h1>'});

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store