How to SendGrid send email with node from terminal

In this post, I am gonna share code snippets which will trigger email along with file content to the given email address usign SendGrid and it will run on top of node js.

Create a folder called emailTrigger and issue npm init --yes, it will create a file called packagejson file. Now install @sendgrid/mail library with npm install @sendgrid/mail.


Now create a file emailTrigger.js along with below code.

In order to trigger email along with the given file content issue following command from your terminal

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

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