我正在尝试通过 curl 使用带有 JSON 和 PHP 的 Mandrill API 发送电子邮件。我可以发送基于文本的电子邮件和基本的 HTML 格式,但是当我尝试从 PHP 发送模板时它不起作用。但是,当将我的 JSON 后字符串复制并粘贴到 Mandril API 页面 ( https://mandrillapp.com/api/docs/messages.html ) 时,它可以正常工作并正确发送!我错过了网站正在添加的东西吗?
{
"key": "XXX",
"template_name": "temp-name",
"template_content": [
{
"name": "example name",
"content": "example content"
}
],
"message": {
"subject": "Welcome to our website",
"from_email": "xxx@gmail.com",
"from_name": "name",
"to": [
{
"email": "xxx@gmail.com",
"name": "name"
}
],
"important": false,
"track_opens": true,
"merge": true,
"global_merge_vars": [
{
"name": "merge1",
"content": "merge1 content"
}
],
"merge_vars": [
{
"rcpt": "recipient.email@example.com",
"vars": [
{
"name": "merge2",
"content": "merge2 content"
}
]
}
],
"tags": [
"invite-send"
]
},
"async": false,
"ip_pool": "Main Pool"
}