对我来说,模板似乎不适用于嵌套输入对象。考虑到模板,我的意思是:
这很好用
<p ">Your Cat Thanks You {{name}}</p>
带有变量:
{name:'joe'}
这不起作用:
<p ">Your Cat Thanks You {{personalInfo.firstName}} {{personalInfo.lastName}}</p>
带有变量:
{personalInfo:{firstName:'John',lastName:'Doe'}}
我正在将nodjs与mailg-js libary一起使用,这些选项似乎还不错:
const mailData= {from: "some shop <[email protected]>",
to: "[email protected]",
subject: "example",
template: exampleTemplateName,
["h:X-Mailgun-Variables"]: JSON.stringify(exampleJson)}
mailgun({
apiKey: api_key,
domain: DOMAIN,
host: "api.eu.mailgun.net"
}).messages().send(mailData)