I am trying to send an email using the Mandrill API with JSON and PHP through curl. I can send a text based email and basic HTML formatting, but when i try to send a template from PHP it does not work. However, when copy and paste my JSON poststring to the Mandril API page (https://mandrillapp.com/api/docs/messages.html) it works and sends correctly! Am I missing something that the website is adding?
{
"key": "XXX",
"template_name": "temp-name",
"template_content": [
{
"name": "example name",
"content": "example content"
}
],
"message": {
"subject": "Welcome to our website",
"from_email": "[email protected]",
"from_name": "name",
"to": [
{
"email": "[email protected]",
"name": "name"
}
],
"important": false,
"track_opens": true,
"merge": true,
"global_merge_vars": [
{
"name": "merge1",
"content": "merge1 content"
}
],
"merge_vars": [
{
"rcpt": "[email protected]",
"vars": [
{
"name": "merge2",
"content": "merge2 content"
}
]
}
],
"tags": [
"invite-send"
]
},
"async": false,
"ip_pool": "Main Pool"
}
i didn't change the messaging URL from "/messages/send.json" to "/messages/send-template.json". Hopefully this helps someone else!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With