Mandrill:merge_vars无效

时间:2015-12-12 14:33:20

标签: php json email mandrill mailmerge

我正致力于通过Mandrill' merge_vars'向用户电子邮件发送不同的链接。但它不起作用。 API日志中的相关部分:

"message": {
    "preserve_recipients": false,
    "auto_text": false,
    "auto_html": false,
    "to": [
        {
            "email": "kajacx10@gmail.com"
        }
    ],
    "html": "... link: *|REFUSELINK|* ...",
    "text": "... link: *|REFUSELINK|* ...",
    "merge": true,
    "merge_language": "mailchimp",
    "merge_vars": [
        {
            "recipient": "kajacx10@gmail.com",
            "vars": [
                {
                    "name": "refuselink",
                    "content": "http://myLink.com"
                }
            ]
        }
    ]
},
"key": "myKey"

我正确收到了电子邮件,但是我看到原来的*|REFUSELINK|*而不是所需的替代品。知道我做错了吗?

1 个答案:

答案 0 :(得分:2)

Ups,它是rcpt,而不是recipient

"merge_vars": [
    {
        "rcpt": "kajacx10@gmail.com", /* <-- here */
        "vars": [
            {
                "name": "refuselink",
                "content": "http://myLink.com"
            }
        ]
    }
]