微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Mailchimp 不呈现变量

如何解决Mailchimp 不呈现变量

我正在使用 Mailchimp 模板通过 Mandrill 发送电子邮件。电子邮件发送成功。但是变量没有呈现。我尝试了很多设置,但不幸的是,它不起作用。我的代码如下所示。

<p>Dear {{customerName}},</p>

<p>Thank you for using XXXXX to process your return.</p>

<p>All you have to do is bring your parcel along with&nbsp;this e-mail to {{pudoLocation}} at {{emailPudoAddress}}.</p>

在电子邮件输出中,它是这样显示的。

EmailOutput

我对 API https://mandrillapp.com/api/1.0/messages/send-template.json 的请求 JSON 是:-

valid json is `{
"key": "xxxxxxxxxxxxxxx","template_name": "TestTemplate","template_content": [],"message": {
    "subject": "Testemail","from_email": "xxx.xx@xxxxx.in","from_name": "Drop2Shop","to": [{
        "Email": "xxxxx.xxx@xxxxxx.in","Name": "Amrit Pannu","Type": "to"
    }],"headers": {
        "Reply-To": "xxxxx.xxx@xxxx.in"
    },"important": false,"track_clicks": true,"track_opens": true,"merge_language": "handlebars","global_merge_vars": [{
        "name": "pudoLocation","content": "TRK00000028"
    },{
        "name": "customerName","content": "TRK00000028"
    }],"tags": [""]
}

}`

请有人帮我看看我在这方面缺少什么吗? 感谢和进步

解决方法

您可以使用 *|VAR1|* 在 mandrill 中传递全局变量。要传递数组,您可以使用 {{handlebars}}。 内容将是这样的:

<p>Dear *|customerName|*,</p>

<p>Thank you for using XXXXX to process your return.</p>

<p>All you have to do is bring your parcel along with&nbsp;this e-mail to *|pudoLocation|* at *|emailPudoAddress|*.</p>

JSON 应该是这样的:

{
   "key": "XXXXXXXXXXXXXXX","template_name": "XXXXXXXXXXXXXXXXXX","template_content": [],"message": {
      "subject": "TestEmail","from_email": "xxxx@xxxxxxxxxxx.in","from_name": "xxxxxx","to": [
         {
            "email": "xxxx@xxxxxxxxxxx.in","name": "xxxxx xxxxx","type": "to"
         }
      ],"headers": {
         "reply_to": "xxxx.xxxx@xxxx.in"
      },"important": false,"track_opens": true,"track_clicks": true,"merge_language": "handlebars","global_merge_vars": [
         {
            "name": "trackingNumber","content": "TRK00000028"
         },{
            "name": "customerName","content": "Amrit Pannu"
         },{
            "name": "eCommerceRetailer","content": "Jojo Retailer"
         },{
            "name": "goodsDescription","content": "Tricycles,Scooters,and Similar Wheeled Toys; Dolls' Carriages"
         },{
            "name": "shippingDate","content": "2021-07-07"
         },{
            "name": "numberOfPackages","content": "45"
         },{
            "name": "shipFromAddress","content": "IRELAND"
         },{
            "name": "shipToAddress","content": "Britain"
         },{
            "Name": "pudoAddress","Content": "USA"
         },{
            "name": "shipFromContact","content": "Commin"
         },{
            "name": "shipToContact","content": "Stark"
         },{
            "name": "customerReference","content": "DF7889FSDHCB"
         },{
            "name": "pudoLocation","content": "Denmark"
         },{
            "name": "emailPudoAddress","content": "amrit@mailinator.com"
         },{
            "name": "unsubscribePageUrl","content": ""
         },{
            "name": "email",{
            "name": "scanEventTime","content": "12:07"
         },{
            "name": "scanEventDate","content": "07 July 2021"
         },{
            "name": "packageItems","content": [
               {
                  "GoodsDescription": "869c6f67-f33d-4b30-a274-79b635d12461","ReturnReason": "c3b4b071-7664-4060-a39f-52c24147a1ce","Quantity": 3,"Value": 6
               },{
                  "GoodsDescription": "5e2c625b-74e6-4e90-bb52-6595e9f3d088","ReturnReason": "f0949b28-f9a7-406e-8676-b8ce6c714509","Value": 14
               },{
                  "GoodsDescription": "cffe036a-2441-41af-82e1-130f9169924b","ReturnReason": "f31956b9-c24e-492e-b11f-4b4e19489b13","Quantity": 1,"Value": 5
               },{
                  "GoodsDescription": "f8f64467-6926-4f08-9d4e-aa924dc1af35","ReturnReason": "d1f759b0-8e54-4119-94ee-6afe1bc49766","Quantity": 4,"Value": 0
               },{
                  "GoodsDescription": "496f4e0e-739d-4fce-8a37-85113f27c4d4","ReturnReason": "b8d98439-928f-4e6c-bb56-01e6f8fb6be6","Quantity": 2,{
                  "GoodsDescription": "afe2986c-e51e-4cfe-9506-f9ef2afa5657","ReturnReason": "4e6e34f6-d921-46fb-8f4a-b04afd0856a7","Value": 12
               },{
                  "GoodsDescription": "13ac561a-d161-46a5-9795-8481e99a3afd","ReturnReason": "73f4441b-dcff-4f68-a58e-320a29a167c8","Value": 7
               },{
                  "GoodsDescription": "135e083b-0408-4445-9a0c-3656a46f7eab","ReturnReason": "325c7144-8f7d-4712-b708-1702416ca02c","Value": 13
               },{
                  "GoodsDescription": "ee510bfd-58ea-4707-9c52-26913b190b27","ReturnReason": "854629a5-289b-46c9-a072-099e2a572307",{
                  "GoodsDescription": "b6d6fa6e-a327-4014-b019-0c4cd0098da6","ReturnReason": "02394799-761c-46f0-af79-d8bc92b2c1b5","Value": 13
               }
            ]
         },{
            "name": "currentYear","content": 2021
         }
      ],"tags": null,"inline_css": true
   }

有关详细信息,请参阅此:https://mailchimp.com/developer/transactional/docs/templates-dynamic-content/#dynamic-content

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。