This node module allows you to quickly and more easily generate SendGrid X-SMTPAPI headers.
All updates to this module are documented in our CHANGELOG.
- Node.js version >=8
- The SendGrid service, starting at the free level
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.envThe following recommended installation requires npm.
Install smtpapi-nodejs and its dependencies:
npm install smtpapi- Please see package.json
var smtpapi = require("smtpapi");
var header = new smtpapi();
header.addTo("[email protected]");
header.setUniqueArgs({ cow: "chicken" });
console.log(header.jsonString());We encourage contribution to our projects, please see our CONTRIBUTING guide for details.
Quick links:
smtpapi-nodejs is maintained and funded by Twilio SendGrid, Inc. The names and logos for smtpapi-nodejs are trademarks of Twilio SendGrid, Inc.
If you need help with SendGrid, please check the Twilio SendGrid Support Help Center.
