I am using the Mandrill API and have a simple template:
<html>
<body>
<p>Hello *|name|*
</p>
</body>
</html>
And am using the send-template.json API from here: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template
And when i insert my payload then the 'name' var is still not populated, any idea why?
{
"key": "secret",
"template_name": "mandrill-sunday",
"template_content": [
{
"name": "example name"
}
],
"message": {
"html": "<p>Example HTML content</p>",
"text": "Example text content",
"subject": "example subject",
"from_email": "[email protected]",
"from_name": "Example Name",
"to": [
{
"email": "[email protected]",
"name": "Recipient Name"
}
],
"headers": {
"Reply-To": "[email protected]"
},
"important": false,
"track_opens": null,
"track_clicks": null,
"auto_text": null,
"auto_html": null,
"inline_css": null,
"url_strip_qs": null,
"preserve_recipients": null,
"bcc_address": "[email protected]",
"tracking_domain": null,
"signing_domain": null,
"merge": true,
"global_merge_vars": [
{
"name": "merge1"
}
],
"merge_vars": [
{
"rcpt": "[email protected]",
"vars": [
{
"name": "merge2"
}
]
}
],
"tags": [
"password-resets"
],
"google_analytics_domains": [
"mydomain.com"
],
"google_analytics_campaign": "mandrill-sunday",
"metadata": {
"website": "www.mydomain.com"
},
"recipient_metadata": [
{
"rcpt": "[email protected]",
"values": {
"user_id": 123456
}
}
]
},
"async": false
}
But the only thing i get back in my email sent is:
Hello *|name|*
Because each replacement requires two fields: its name and its contents. So your merge should become something like:
"vars": [
{
"name": "name",
"content" : "merge2"
}
]