Reputation: 1725
I have a template on my mandrill account called "template1", I want to use it to send mail to multiple recipients. It does not work. The mail is sent but the template content is not included. The code is:
//truncated for brevity
var m = new mandrill.Mandrill(my_key');
var params = {
"template_name": "template1",
"template_content": [
{
"name": "template1",
"content": "template1"
}
],
"message": {
"from_email":"[email protected]",
"to": emailObjects,
"subject": "Sales director job",
"text": "text in the message"
}
};
m.messages.send(params, function(res) {
log(res);
},
As I said the message is sent but the body of the message is the "text" portion at the bottom of the params instead of the template. If I remove that (the params "text" line) there is no body content at all in the email!
The second question is: how can I hide the email addresses of the other people who receive the message? It goes to multiple recipients and all the addresses are visible which is very undesirable!
Thank you in advance for suggestions.
Upvotes: 2
Views: 1788
Reputation: 7932
Part 2, add the default setting in Mandrill Settings > Sending Defaults
as described above or override as follows - this example prevents the list of recipients being shown:
var m = new mandrill.Mandrill(my_key');
var params = {
"preserve_recipients": false,
...
}
}
Upvotes: 2
Reputation: 2226
You can include cc addresses when sending through SMTP. Whether recipients see each other's email address(es) depends on your account settings and whether you've set the X-MC-PreserveRecipients header.
Set your Mandrill account to preserve the recipients for emails you send by default
If you're using the SMTP integration, you can use the SMTP Headers API to set a custom header to preserve the recipients on a per-message basis. Use the X-MC-PreserveRecipients header, and set it to true for your recipients to be able to see other recipient email addresses.
It's not possible to specify "CC" addresses via the API, but your account default option will be applied unless you specify the preserve_recipients parameter: false means recipients won't see other recipient email addresses; true will allow recipients to view and reply-all for all recipients.
For additional information: http://help.mandrill.com/entries/21751312-Can-I-send-to-more-than-one-recipient-at-a-time-
Upvotes: 0