SendGrid's smtpapi library in NodeJS

License: MIT

Language: JavaScript


This node module allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.


All updates to this module is documented in our CHANGELOG.



  • Node.js version 0.10, 0.12 or 4
  • The SendGrid service, starting at the free level

Environment Variables

Update your environment with your SendGrid credentials. (if you will be sending via nodemailer or other SMTP transport)

echo "export SENDGRID_USERNAME='YOUR_USERNAME'" > sendgrid.env
echo "export SENDGRID_PASSWORD='YOUR_PASSWORD'" >> sendgrid.env
echo "sendgrid.env" >> .gitignore
source ./sendgrid.env

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.

Add the following to your package.json file:

  "dependencies": {
    "smtpapi": "1.3.1"

Install smtpapi-nodejs and its dependencies:

npm install


Quick Start

var smtpapi   = require('smtpapi');
var header    = new smtpapi();
header.setUniqueArgs({cow: 'chicken'});



If you are intersted in the future direction of this project, please take a look at our milestones. We would love to hear your feedback.

How to Contribute

We encourage contribution to our projects, please see our CONTRIBUTING guide for details.

Quick links:


smtpapi-nodejs is guided and supported by the SendGrid Developer Experience Team.

smtpapi-nodejs is maintained and funded by SendGrid, Inc. The names and logos for smtpapi-nodejs are trademarks of SendGrid, Inc.

![SendGrid Logo] (

Project Statistics

Sourcerank 10
Repository Size 126 KB
Stars 33
Forks 45
Watchers 166
Open issues 25
Dependencies 2
Contributors 17
Tags 10
Last updated
Last pushed

Top Contributors See all

Mot Elmer Thomas Eddie Zaneski Wataru Sato Brandon West SendGrid's DX Team Nick Quinlan Yamil Asusta Robert mell0kat Roy Paterson Brad Walton Frode Jensen Ben Neal Sorin Baba Richard Key Limian Wang

Packages Referencing this Repo

Build SendGrid X-SMTPAPI headers in nodejs.
Latest release 1.3.1 - Updated - 33 stars

Recent Tags See all

v1.3.1 April 11, 2017
v1.3.0 April 06, 2017
v1.2.0 July 19, 2015
v1.1.0 February 03, 2015
v1.0.4 October 25, 2014
v1.0.3 June 03, 2014
v1.0.2 May 28, 2014
v1.0.1 May 28, 2014
v0.0.2 April 16, 2014
v0.0.1 December 30, 2013

Something wrong with this page? Make a suggestion

Last synced: 2017-04-11 01:26:19 UTC

Login to resync this repository