如何在电子邮件模板中使用自定义 mailgun 变量?
How to use custom mailgun variable inside email template?
我正在使用 mailgun-js 库从 nodejs 服务器发送电子邮件。
如何使用一些自定义变量填充通过 mailgun 发送的 html 电子邮件模板?
对于接收者变量,它的工作方式类似于 html 模板中的 %recipient.custom-variable%
,并且在服务器端使用这样的代码:
let email = {
from: 'my@email.com',
to: emailsArray,
subject: 'my subject',
html: template,
'recipient-variables': emailsArray.map(e=>{e:{custom-variable: user.customThing}})
};
return mailgun.create(email);
但我有一些变量,所有收件人都应该相同。
如何设置自定义变量以及如何在模板中使用它(以接收者变量的方式)?
似乎无法使用自定义变量,只能使用 recipient-variables
。
我正在使用 mailgun-js 库从 nodejs 服务器发送电子邮件。
如何使用一些自定义变量填充通过 mailgun 发送的 html 电子邮件模板?
对于接收者变量,它的工作方式类似于 html 模板中的 %recipient.custom-variable%
,并且在服务器端使用这样的代码:
let email = {
from: 'my@email.com',
to: emailsArray,
subject: 'my subject',
html: template,
'recipient-variables': emailsArray.map(e=>{e:{custom-variable: user.customThing}})
};
return mailgun.create(email);
但我有一些变量,所有收件人都应该相同。
如何设置自定义变量以及如何在模板中使用它(以接收者变量的方式)?
似乎无法使用自定义变量,只能使用 recipient-variables
。