How to send email using SendGrid in NodeJS/JavaScript?

SendGrid is a great alternative to send emails in JavaScript / NodeJS. Setup of SendGrid in node js project is kinda very simple. Let’s send email using SendGrid.

Node js is all prerequisite for SendGrid to begin with. Let’s assume you have a NodeJS and you want to integrate your project with SendGrid to send emails.

Sendgrid have an npm package @sendgrid/mail, install this package in your project by running following command.

npm install --save @sendgrid/mail

Once this npm package is installed, go to your file from where you want to send the emails.

Before you write any code one more thing is required and that is the API key. You can easily get an API key by logging in to the SendGrid website and creating a new API key.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,