Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

v2 API Node.js Code Example


(information)

Info

We recommend using v3 SendGrid Node.js, our client library, available on GitHub(link takes you to an external page), with full documentation.

(information)

Info

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(link takes you to an external page).


Using SendGrid's Node.js Library

using-sendgrids-nodejs-library page anchor

_11
// using SendGrid's Node.js Library
_11
// https://github.com/sendgrid/sendgrid-nodejs
_11
const sendgrid = require("sendgrid")("SENDGRID_APIKEY");
_11
const email = new sendgrid.Email();
_11
_11
email.addTo("test@sendgrid.com");
_11
email.setFrom("you@youremail.com");
_11
email.setSubject("Sending an email with SendGrid is Fun");
_11
email.setHtml("and easy to do anywhere, even with Node.js");
_11
_11
sendgrid.send(email);


Rate this page: