山魈把手示例
Mandrill handlebars example
我的 html 内容中的变量似乎已被删除,因此电子邮件中没有显示任何动态内容。模板语言在代码中和全局设置为handlebars。
文档似乎没有提供任何其他细节或示例。没有错误消息。
var subject = "A really great subject";
var htmlContent = "<h1>Hi, {{user}}</h1><p>{{productName}}?</p><br/><a href='{{unsub redirect_merge_var}}'>Unsubscribe</a>"
var mailJSON ={
"key": "myKey",
"merge_language": "handlebars",
"merge": true,
"global_merge_vars": [
{
"name": "productName",
"content": "Mandrill_User1"
},
{
"name": "user",
"content": "cool guy"
}
],
"message": {
"html": htmlContent,
"subject": subject,
"from_email": "stuff@xxxxxxxxxx.com",
"from_name": "stuff-app",
"to": [
{
"email": ""+person.email,
"name": ""+person.name,
"type": "to"
}
],
"important": false,
"track_opens": null,
"track_clicks": null,
"auto_text": null,
"auto_html": null,
"inline_css": null,
"url_strip_qs": null,
"preserve_recipients": null,
"view_content_link": null,
"tracking_domain": null,
"signing_domain": null,
"return_path_domain": null
},
"async": false,
"ip_pool": "Main Pool"
}
移动这个:
"merge_language": "handlebars",
"merge": true,
"global_merge_vars": […],
进入您的 message
结构。 (Official API documentation)
如果不需要,您也可以删除 NULL 值。
我的 html 内容中的变量似乎已被删除,因此电子邮件中没有显示任何动态内容。模板语言在代码中和全局设置为handlebars。
文档似乎没有提供任何其他细节或示例。没有错误消息。
var subject = "A really great subject";
var htmlContent = "<h1>Hi, {{user}}</h1><p>{{productName}}?</p><br/><a href='{{unsub redirect_merge_var}}'>Unsubscribe</a>"
var mailJSON ={
"key": "myKey",
"merge_language": "handlebars",
"merge": true,
"global_merge_vars": [
{
"name": "productName",
"content": "Mandrill_User1"
},
{
"name": "user",
"content": "cool guy"
}
],
"message": {
"html": htmlContent,
"subject": subject,
"from_email": "stuff@xxxxxxxxxx.com",
"from_name": "stuff-app",
"to": [
{
"email": ""+person.email,
"name": ""+person.name,
"type": "to"
}
],
"important": false,
"track_opens": null,
"track_clicks": null,
"auto_text": null,
"auto_html": null,
"inline_css": null,
"url_strip_qs": null,
"preserve_recipients": null,
"view_content_link": null,
"tracking_domain": null,
"signing_domain": null,
"return_path_domain": null
},
"async": false,
"ip_pool": "Main Pool"
}
移动这个:
"merge_language": "handlebars",
"merge": true,
"global_merge_vars": […],
进入您的 message
结构。 (Official API documentation)
如果不需要,您也可以删除 NULL 值。