Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

smtpapi

sendgrid76.6kBSD1.4.7TypeScript support: definitely-typed

Build SendGrid X-SMTPAPI headers in nodejs.

smtpapi, x-smtpapi, smtp, sendgrid, headers, email

readme

SendGrid Logo

Test and Deploy npm MIT licensed Twitter Follow GitHub contributors

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

Announcements

The default branch name for this repository has been changed to main as of 07/27/2020.

All updates to this module are documented in our CHANGELOG.

Table of Contents

Installation

Prerequisites

  • Node.js version 4, 5, 6, 7, 8, 10, 12, 14, or 16
  • 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.

Install smtpapi-nodejs and its dependencies:

npm install smtpapi

Dependencies

Quick Start

var smtpapi = require("smtpapi");
var header = new smtpapi();
header.addTo("test@example.com");
header.setUniqueArgs({ cow: "chicken" });
console.log(header.jsonString());

Usage

How to Contribute

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

Quick links:

About

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 installing or using the library, please check the Twilio SendGrid Support Help Center.

If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!

License

The MIT License (MIT)

changelog

Change Log

All notable changes to this project will be documented in this file.

[2022-03-09] Version 1.4.7

Library - Chore

[2022-02-09] Version 1.4.6

Library - Chore

[2022-01-12] Version 1.4.5

Library - Chore

[2020-09-02] Version 1.4.4

Library - Docs

[2020-08-19] Version 1.4.3

Library - Chore

[2020-02-19] Version 1.4.2

Library - Test

[2020-01-22] Version 1.4.1

Library - Docs

[2020-01-15] Version 1.4.0

Library - Docs

Library - Fix

Library - Test

  • PR #60: Added unittest to check for specific repo files. Thanks to @mptap!
  • PR #62: Add a unittest to check the license.md file date range. Thanks to @lvarayut!

Library - Chore

Library - Feature

[2017-04-10] Version 1.3.1

Fixed

  • 16 Fixed issue where concat was used incorrectly.

  • Thanks to Limian Wang for the PR!

[1.3.0] - 2017-4-6

Added

  • 19 Adds setBatchId method.

  • Thanks to mell0kat for the PR!

[1.2.0] - 2015-7-19

Added

  • IP Pool support

[1.1.0] - 2015-2-3

Added

  • ASM Group ID support
  • CHANGELOG.md