javascript - 如何访问mailgun模板中的自定义变量?
问题描述
我将 mailgun 与 nodejs 一起使用,并希望使用他们的自定义模板之一。
// using template
var resetlink = 'https://myurl.com/reset/dkadlkw334sada';
var dataMail = {
from: 'Me <me@me.com>',
to: 'mail@gmail.com',
subject: 'password reset',
template: "pwrecovery",
"v:link":resetlink
};
// execute send
mg.messages().send(dataMail, function(error, body) {
if (error) {
}
console.log(body);
});
这工作正常,我可以在 mailgun 的日志控制台中看到使用此变量传递的邮件。
但是,我需要电子邮件模板中的这个链接。我试过了
<td class="em_white" height="42" align="center" valign="middle" style="font-family: Arial, sans-serif; font-size: 16px; color:#ffffff; font-weight:bold; height:42px;"><a href=%recipient.link% target="_blank" style="text-decoration:none; color:#ffffff; line-height:42px; display:block;">RESET YOUR PASSWORD</a></td>
还有:
<p> the link: {{recipient-variables.link}} </p>
但这些都不起作用。如何在 html 模板中访问和显示这个变量 resetlink?
解决方案
推荐阅读
- css - 如何在弹性框中添加元素之间的空间
- java - 使用 ServletFileUpload 上传图像会在本地环境和 aws 环境中提供两种不同的文件大小
- android - 无法使用“建议快捷方式 In-App Promo SDK”打开快捷方式 Intent
- reactjs - 使用在 Windows 上的 Linux/Mac 上开发的 ReactJS
- javascript - 为什么路径变量会丢失字符?
- ios - 登录后如何显示用户的名字?
- linux - 为什么proc_read()是Linux中与/proc相关的函数,被“反复”调用,直到返回0?
- javascript - 尽管重新启动浏览器,ember-simple-auth 用户仍保持登录状态
- reactjs - VSCode - 更新文件名更改的导入路径?
- javascript - Vuetify - 观察 v-app-bar 的变化,例如 onScroll()