Nodemailer TypeScript
//Example with Sendgrid
const nodemailer = require('nodemailer');
const sendgridTransport = require('nodemailer-sendgrid-transport');
const transporter = nodemailer.createTransport(sendgridTransport({
auth: {
api_key: '<your-API-key>'
}
}));
app.post('/api/mail', () => {
transporter.sendMail({
to: '[email protected]',
from: '[email protected]',
subject: 'Test',
html: '<h1>Success</h1>'
})
.catch(err => {
console.log(err);
});
});
MitchAloha