JSPM

  • Created
  • Published
  • Downloads 1748997
  • Score
    100M100P100Q197256F
  • License MIT

SendGrid NodeJS mail service

Package Exports

  • @sendgrid/mail

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sendgrid/mail) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

Installation

Prerequisites

  • Node.js version 6, 7 or 8
  • The SendGrid service, starting at the free level

Setup Environment Variables

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

For more complex use cases, please see USE_CASES.md.

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: 'test@example.com',
  from: 'test@example.com',
  subject: 'Sending with 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>',
};
sgMail.send(msg);

Troubleshooting

Please see our troubleshooting guide for common library issues.

Announcements

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.

Roadmap

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.

Troubleshooting

Please see our troubleshooting guide for common library issues.

About

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

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

SendGrid Logo