v3 API Node.js Code Example

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

Do you have an API Key yet? If not, go get one. You're going to need it to integrate!

Using SendGrid's Node.js Library

// using SendGrid's v3 Node.js Library
// https://github.com/sendgrid/sendgrid-nodejs
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);
See a mistake? Edit this page