Send a templated email to the specified recipient.
var Mandrill = require('machinepack-mandrill');
// Send a templated email to the specified recipient.
Mandrill.sendTemplateEmail({
apiKey: '1dTOFDXzJdU5cXiMNd6jRq',
toEmail: '[email protected]',
templateName: 'myTemplate',
toName: 'Jane Doe',
subject: 'Welcome, Jane!',
templateContent: [ { name: 'of attribute', content: 'of attribute' } ],
message: 'Jane,\n' + "Thanks for joining our community. If you have any questions, please don't hesitate to send them our way. Feel free to reply to this email directly.\n" + '\n' + 'Sincerely,\n' + 'The Management',
fromEmail: '[email protected]',
fromName: 'Harold Greaseworthy',
mergeVars: [ { name: 'FNAME', content: 'First Name' } ],
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// OK.
success: function () {
},
});
A valid Mandrill API key.
'1dTOFDXzJdU5cXiMNd6jRq'
Email address of the primary recipient.
'[email protected]'
The template's name
'myTemplate'
Full name of the primary recipient.
'Jane Doe'
Subject line for the email.
'Welcome, Jane!'
An array of data you want to inject into the template.
[ { name: 'of attribute', content: 'of attribute' } ]
Optional full text content to be sent
'Jane,\n' +
"Thanks for joining our community. If you have any questions, please don't hesitate to send them our way. Feel free to reply to this email directly.\n" +
'\n' +
'Sincerely,\n' +
'The Management'
Email address of the sender.
'[email protected]'
Full name of the sender.
'Harold Greaseworthy'
Content to be placed within template merge tags.
[ { name: 'FNAME', content: 'First Name' } ]
An unexpected error occurred.
OK.
N/A