sendgrid api client nodejs code example
Example 1: node js sendgrid
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: '[email protected]',
from: '[email protected]',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
};
sgMail.send(msg).catch(err => {
console.log(err);
});
Example 2: node js sendgrid
npm install @sendgrid/mail