Send emails via Mandrill. Saves you having to setup the whole email object each time.
2.0.1 - Breaking changes. Moved from Mandrill to SparkPost to avoid Mandrill price hike.
1.0.0 - Breaking changes. Introduced options to allow sending from another email than in config
0.0.1 - Initial release.
npm install shnappy-emailer --save
var emailer = require('shnappy-emailer');
var message = {
subject: 'Test',
html: '<p>Hi</p>',
text: 'Hi',
to: {
name: 'Daniel',
email: '[email protected]'
}
}
// These are all optional. Most values will read from config if not provided.
var options = {
from: {
name: 'Test',
email: '[email protected]'
},
replyTo: '[email protected]',
sendAt: new Date().toISOString()
};
emailer.SendEmail(to, 'Subject', message, function(data){
// Check data to see if it worked.
});
SendEmail(messageObject, options, callback)
SendEmail(messageObject, callback)