如何在电子邮件模板中使用自定义的mailgun变量?

问题描述:

我使用mailgun-js库从nodejs服务器发送电子邮件。如何在电子邮件模板中使用自定义的mailgun变量?

我如何填充通过mailgun发送的具有一些自定义变量的html电子邮件组队?

收件人变量它就像%recipient.custom-variable%在HTML模板,并与服务器端的代码,例如:

let email = { 
    from: '[email protected]', 
    to: emailsArray, 
    subject: 'my subject', 
    html: template, 
    'recipient-variables': emailsArray.map(e=>{e:{custom-variable: user.customThing}}) 
}; 

return mailgun.create(email); 

但我有一些变量,它应该是对所有收件人是相同的。

如何设置自定义变量以及如何在模板内使用它(以收件人变量的方式)?

它似乎不可能使用自定义变量,只能与recipient-variables