Mandrill.sendTemplateEmail()

Send a templated email to the specified recipient.

Usage

Hover over inputs/exits for more info.

var Mandrill = require('machinepack-mandrill');


// Send a templated email to the specified recipient.

Mandrill.sendTemplateEmail({

apiKey: '1dTOFDXzJdU5cXiMNd6jRq',

toEmail: 'jane@example.com',

templateName: 'myTemplate',

toName: 'Jane Doe',

subject: 'Welcome, Jane!',

templateContent: [ { name: 'of attribute', content: 'of attribute' } ],

message: 'Jane,\nThanks 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\nSincerely,\nThe Management',

fromEmail: 'harold@example.enterprise',

fromName: 'Harold Greaseworthy',

mergeVars: [ { name: 'FNAME', content: 'First Name' } ],

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

apiKey required

A valid Mandrill API key.

'1dTOFDXzJdU5cXiMNd6jRq'
toEmail required

Email address of the primary recipient.

'jane@example.com'
templateName required

The template's name

'myTemplate'
toName

Full name of the primary recipient.

'Jane Doe'
subject

Subject line for the email.

'Welcome, Jane!'
templateContent

An array of data you want to inject into the template.

[ { name: 'of attribute', content: 'of attribute' } ]
message

Optional full text content to be sent

'Jane,\nThanks 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\nSincerely,\nThe Management'
fromEmail

Email address of the sender.

'harold@example.enterprise'
fromName

Full name of the sender.

'Harold Greaseworthy'
mergeVars

Content to be placed within template merge tags.

[ { name: 'FNAME', content: 'First Name' } ]

Exits

error

An unexpected error occurred.

success

OK.

N/A