Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending a template email from Mandrill using API is empty

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"
}
like image 263
jme Avatar asked Feb 16 '23 17:02

jme


1 Answers

i didn't change the messaging URL from "/messages/send.json" to "/messages/send-template.json". Hopefully this helps someone else!

like image 88
jme Avatar answered Feb 18 '23 10:02

jme