1
我正在使用Mandrill的發送模板API方法發送電子郵件。它應該不重要,但以防萬一,我正在使用PHP。我如何讓Mandrill解析模板中的Handlebars標籤?
電子郵件是使用正確的模板提供的,但沒有任何Handlebars變量被替換爲它們的值。相反,他們只是被刪除。
這裏所看到的API日誌減少我的代碼後,完整的請求:
{
"template_name": "my-template-slug",
"template_content": [
{
"name": "price",
"content": "$25"
}
],
"message": {
"subject": "My Subject",
"from_email": "[email protected]",
"from_name": "My Name",
"to": [
{
"name": "Jimmy Crackcorn",
"type": "to",
"email": "[email protected]"
}
]
},
"async": false,
"ip_pool": null,
"send_at": null,
"key": "my_api_key"
}
我還試圖簡化我的模板,只是{{price}}
,這只是發送一個空白郵件。
我也驗證了將發送默認值>合併語言設置爲Handlebars。
如果它有什麼區別,我在MailChimp中創建了模板並將它發送到Mandrill,然後從變量中刪除了轉義的反斜線。