We will deprecate this version on February 10, 2025. To access all the latest features and upcoming developments, please see our v3 API. For assistance with transitioning, refer to our migration guide.
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.
1// using SendGrid's Node.js Library2// https://github.com/sendgrid/sendgrid-nodejs3const sendgrid = require("sendgrid")("SENDGRID_APIKEY");4const email = new sendgrid.Email();56email.addTo("test@sendgrid.com");7email.setFrom("you@youremail.com");8email.setSubject("Sending an email with SendGrid is Fun");9email.setHtml("and easy to do anywhere, even with Node.js");1011sendgrid.send(email);