Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Parse platform Can';无法使合并标记正常工作-Mandrill/Parse_Parse Platform_Mandrill - Fatal编程技术网

Parse platform Can';无法使合并标记正常工作-Mandrill/Parse

Parse platform Can';无法使合并标记正常工作-Mandrill/Parse,parse-platform,mandrill,Parse Platform,Mandrill,下面是我的解析云代码调用: Mandrill.sendTemplate({ "template_name": "start-conversation", "template_content": [{ "name": "example name", "content": "example content" //Those are required but they are ignored }], "message": {

下面是我的解析云代码调用:

 Mandrill.sendTemplate({
    "template_name": "start-conversation",
    "template_content": [{
        "name": "example name",
        "content": "example content" //Those are required but they are ignored
    }],
    "message": {
        "to": [{
            "email": request.params.toUserEmail,
            "name": request.params.toUserName
        }],
        "important": true, 
        "merge": true,
        "global_merge_vars": [
            {
                "rcpt": request.params.toUserEmail,
                "vars": [
                    {
                        "name": "TOUSERNAME",
                        "content": request.params.toUserName
                    },
                    {
                        "name": "FROMUSERNAME",
                        "content": request.params.fromUserName
                    },
                    {
                        "name": "TOPICNAME",
                        "content": request.params.topicName
                    },
                     {
                        "name": "LANGUAGE",
                        "content": request.params.language
                    }
                ]
            }
        ],
    },

  "async": true
},{
  success: function(httpResponse) {
    console.log(httpResponse);
    response.success("mandrillStartConvoRequest -- success -- Email sent!");
  },
  error: function(httpResponse) {
    console.error(httpResponse);
    response.error("mandrillStartConvoRequest -- error -- Uh oh, something went wrong");
  }
});
下面是我的Mandrill模板中带有标记的

 <span style="line-height:20.7999992370605px">
 *|TOUSERNAME|*
 <br><br>
 *|FROMUSERNAME|* would like to start a conversation with you about *|TOPICNAME|* in *|LANGUAGE|*     </span>

*|图瑟纳姆|*


*|FROMUSERNAME |*想用*|语言与您就*| TOPICNAME |*展开对话
电子邮件发送正常,但没有合并=(:


据我所知,内置的Mandrill.sendTemplate方法不起作用。 因此,您应该尝试自己调用mandrill API,只需执行HTTP POST即可

更新: 我在我的项目中使用的是这样的,请注意,我使用的是合并变量,而您使用的是全局合并变量

        var params = {
          key: "xxxxxxxxxxxx",
          template_name: "$template_name",
          template_content: [],
          message: {
            to: [
              {
                email: email
              }
            ],
            merge_vars : [{
              rcpt: email,
              vars:[
                {
                  "name" : "from",
                  "content" : "Test"
                }
              ]
            }]
          },
          async: true
        };

        Parse.Cloud.httpRequest({
          method: "POST",
          headers: {
            "Content-Type": "application/json",
          },
          url: "https://mandrillapp.com/api/1.0/messages/send-template.json",
          body: params,
          success: function(httpResponse) {
              response.success("email sent");
            },
          error: function(httpResponse) {
              console.error(httpResponse);
              response.error("Uh oh, something went wrong");
            }
        });

我试过了,但没有合并。同样的问题。事实上,成功了!一定是我4分钟前看到的一封延迟的电子邮件。~谢谢。