Mandrill不会替换html模板

时间:2016-02-09 13:00:09

标签: php api mandrill

     Mandrill API Logs  -- 

"subject": "Valentine’s Day special offer. Additional 10% off* on select categories! View exclusive online offer",
        "from_email": "habits@zip.in",
        "from_name": "zipp",
        "to": [
            {
                "email": "xyza_123@gmail.com",
                "name": "venk",
                "type": "to"
            }
        ],
        "merge": true,
        "merge_vars": [
            {
                "rcpt": "xyza_123@gmail.com",
                "vars": [
                    {
                        "name": "UNSUB",
                        "content": "http://zyr.com/unsubscribe/GYT786HHG"
                    },
                    {
                        "name": "FirstName",
                        "content": "venk"
                    }
                ]
            }
        ],

    "async": false,
    "ip_pool": null,
    "send_at": null,

当我点击模板中的unsubscriber链接时,它会转到我的网址http://*|unsub|*。 Mandrill没有用http://zyr.com/unsubscribe/GYT&786HHG替换 | UNSUB | 。请帮我 。我花了很多时间,但我无法解决它

                                                 

                <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnTextContentContainer">
                    <tbody><tr>

                        <td valign="top" class="mcnTextContent" style="padding-top:9px; padding-right: 18px; padding-bottom: 9px; padding-left: 18px;">

                            You can&nbsp;<a href="*|UNSUB|*" target="_blank">unsubscribe</a><br>
<br>
&nbsp;
                       </td>
                    </tr>
                </tbody></table>
            </td>
        </tr>
    </tbody>
</table>

1 个答案:

答案 0 :(得分:1)

没有必要将UNSUB作为合并变量传递。 Mandrill takes care of all of that for you。 UNSUB也是一个保留的合并标记,这就是为什么它不会被您在API调用中传递的值替换。

因此,在您的API调用中,完全删除merge var:

 {
                    "name": "UNSUB",
                    "content": "http://zyr.com/unsubscribe/GYT786HHG"
                },

在HTML模板中,请改用:

You can&nbsp;<a href="*|UNSUB:http://zyr.com/unsubscribe/GYT786HHG|*" target="_blank">unsubscribe</a><br>