Skip to content

Instantly share code, notes, and snippets.

@dcortesnet
Last active February 14, 2023 12:27
Show Gist options
  • Select an option

  • Save dcortesnet/7b6565c2647d579e2fa0a5e591338266 to your computer and use it in GitHub Desktop.

Select an option

Save dcortesnet/7b6565c2647d579e2fa0a5e591338266 to your computer and use it in GitHub Desktop.
Nodejs send email with sendgrid
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment