Need private packages and team management tools?Check out npm Orgs. »


6.4.0 • Public • Published

BuildStatus npm version Email Notifications Badge

This package is part of a monorepo, please see this README for details.

Mail Service for the Sendgrid v3 Web API

This is a dedicated service for interaction with the mail endpoint of the Sendgrid v3 API.

To be notified when this package is updated, please subscribe to email notifications for releases and breaking changes.



  • Node.js version 6, 7 or 8
  • A Twilio SendGrid account, sign up for free to send up to 40,000 emails for the first 30 days or check out our pricing.

Obtain an API Key

Grab your API Key from the Twilio SendGrid UI.

Setup Environment Variables

Do not hardcode your Twilio SendGrid API Key into your code. Instead, use an environment variable or some other secure means of protecting your Twilio SendGrid API Key. Following is an example of using an environment variable.

Update the development environment with your SENDGRID_API_KEY, for example:

echo "export SENDGRID_API_KEY='YOUR_API_KEY'" > sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env

Install Package

The following recommended installation requires npm. If you are unfamiliar with npm, see the npm docs. Npm comes installed with Node.js since node version 0.8.x, therefore, you likely already have it.

npm install --save @sendgrid/mail

You may also use yarn to install.

yarn add @sendgrid/mail

Quick Start, Hello Email

The following is the minimum needed code to send a simple email. Use this example, and modify the to and from variables:

For more complex use cases, please see

const sgMail = require('@sendgrid/mail');
const msg = {
  to: '',
  from: '',
  subject: 'Sending with Twilio SendGrid is Fun',
  text: 'and easy to do anywhere, even with Node.js',
  html: '<strong>and easy to do anywhere, even with Node.js</strong>',

After executing the above code, you should have an email in the inbox of the recipient. You can check the status of your email in the UI. Alternatively, we can post events to a URL of your choice using our Event Webhook. This gives you data about the events that occur as Twilio SendGrid processes your email.


Please see our troubleshooting guide for common library issues.


All updates to this library are documented in our CHANGELOG and releases. You may also subscribe to email release notifications for releases and breaking changes.


If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback!

How to Contribute

We encourage contribution to our libraries (you might even score some nifty swag), please see our CONTRIBUTING guide for details.


Please see our troubleshooting guide for common library issues.


@sendgrid/mail is guided and supported by the Twilio SendGrid Developer Experience Team.

@sendgrid/mail is maintained and funded by Twilio SendGrid, Inc. The names and logos for @sendgrid/mail are trademarks of Twilio SendGrid, Inc.

Twilio SendGrid Logo




npm i @sendgrid/mail

Downloadsweekly downloads









last publish


  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability