I am new to programming and would like to send a template via the mandrill api. Sending a message works fine. What do I have to change in my code to send a template? In the mandrill documentation I see that I can call a template I have stored in my account with this
"template_name": "example template_name",
But I don't know how to integrate this properly in my code below.
I would appreciate any help you can give. For the purpose of understanding the easiest would be if you can show me how the code would have to look in order to send the template.
function log(obj) {
$('#response').text(JSON.stringify(obj));
}
var m = new mandrill.Mandrill('API Key');
var params = {
"message": {
"from_email":"example@domain.com",
"from_name": "FromExampleName",
"to":[{"email":"recipient1@domain.com", "name": "Name of Recipient"}],
"subject": "Mandrill API Test",
"html": "Sending a template doesn't work."
}
};
function sendTheMail() {
m.messages.send(params, function(res) {
log(res);
}, function(err) {
log(err);
});
}