我正在使用Mandrill的send-template API方法发送电子邮件 . 这应该没关系,但为了以防万一,我正在使用PHP .
电子邮件使用正确的模板传递,但没有任何Handlebars变量被替换为其值 . 相反,他们只是被删除 .
这是在减少我的代码后在API日志中看到的完整请求:
{
"template_name": "my-template-slug",
"template_content": [
{
"name": "price",
"content": "$25"
}
],
"message": {
"subject": "My Subject",
"from_email": "my@email.com",
"from_name": "My Name",
"to": [
{
"name": "Jimmy Crackcorn",
"type": "to",
"email": "jimmy@crackcorn.com"
}
]
},
"async": false,
"ip_pool": null,
"send_at": null,
"key": "my_api_key"
}
我也尝试将我的模板简化为 {{price}}
,只发送一封空白电子邮件 .
我还验证了发送默认值>合并语言设置为Handlebars .
如果它有任何区别,我在MailChimp中创建了模板并将其发送到Mandrill,然后从变量中删除了转义的反斜杠 .
1 回答
把手应该在API请求中的
merge_vars
或global_merge_vars
参数中传递,而不是template_content
- 这是mc:edit regions for the MailChimp template language .