Skip to content

Instantly share code, notes, and snippets.

@rimiti
Last active August 20, 2019 08:28
Show Gist options
  • Save rimiti/5334e74b5231a5089d9aa63e0eb4afc2 to your computer and use it in GitHub Desktop.
Save rimiti/5334e74b5231a5089d9aa63e0eb4afc2 to your computer and use it in GitHub Desktop.
Sending an email with Mandrill
const nodemailer = require("nodemailer");
const mandrillTransport = require('nodemailer-mandrill-transport');
const smtpTransport = nodemailer.createTransport(mandrillTransport({
auth: {
apiKey : 'your-token'
}
}));
const mailData = {
from : '[email protected]',
to : '[email protected]',
subject : "Test",
html : "Hello<br> How are you doing?"
};
smtpTransport.sendMail(mailData, function(error, response){
if(error) {
throw new Error("Error in sending email");
}
console.log("Message sent: " + JSON.stringify(response));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment