v2 API Node.js Code Example

We recommend using v3 SendGrid Node.js, our client library, available on GitHub, with full documentation.

The library does not officially support the V2 API, but you can use V2 with an older version of the library. For more information, see Continue Using V2 in Node.js.

Using SendGrid's Node.js Library

// using SendGrid's Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
const sendgrid = require("sendgrid")("SENDGRID_APIKEY");
const email = new sendgrid.Email();

email.setSubject("Sending an email with SendGrid is Fun");
email.setHtml("and easy to do anywhere, even with Node.js");

See a mistake? Edit this page