Send Email using SendGrid in Express.JS application

In this arti­cle, I will demon­strate a sim­ple exam­ple of send­ing emails using SendGrid in Express/ Node.js. Fortunately sending emails in express/node js pretty easy with SendGrid using @sendgrid/mail npm package.

For sending HTML emails we are going to use template engine called pugjs, this project was formerly known as Jade.

Create package.json file and keep it in any folder. Put the below code in it.


issue npm init command to generate package.json and after generating, issue following commands to install express js, pugjs and @sendgrid/mail dependencies, npm install --save pug express @sendgrid/mail



Run the app with the following command:

Then, load http://localhost:8000/ in a browser to see the output.

By Arjun

I am Arjun from Hyderabad (India). I have been working as a software engineer from the last 7+ years, and it is my passion to learn new things and implement them as a practice. Aside from work, I like gardening and spending time with pets.

Leave a Reply

Your email address will not be published. Required fields are marked *