javascript - 无法自定义 AWS SES 电子邮件模板
问题描述
我正在尝试通过 AWS SES 服务发送忘记密码的邮件。我做了这个模板
{
"Template":{
"TemplateName": "forgotpasswrd",
"SubjectPart": "Forgot password ",
"TextPart":"Text area",
"HtmlPart":"<p>We heard that you lost your password. Sorry about that!<\/p>\r\n <p>But don\u2019t worry! You can use the following link to reset your password:<\/p>\r\n <a href=${url}>${url}<\/a>\r\n <p>If you don\u2019t use this link within 1 hour, it will expire.<\/p>\r\n "
}
}
这是我在 nodejs 中输入密码重置链接的代码。
const params = {};
const destination = {
ToAddresses: [String(email)],
};
const templateData = {};
templateData.url = String(Url);
params.Source = 'myemailid@gmail.com';
params.Destination = destination;
params.Template = 'forgotpassword';
params.TemplateData = JSON.stringify(templateData);
这Url
就是我要发送的内容。
但是,当我收到邮件时,它不显示链接,而只显示 html 文本
" 不过不用担心!您可以使用以下链接重设密码:
${url} 如果您在 1 小时内不使用此链接,它将过期。”
如何在邮件中发送链接?
解决方案
应该是{{url}}
,不是${url}
。请参阅文档。
推荐阅读
- node.js - 异步等待 Fetch 给出未定义
- automation - 设置循环计数的目的
- angular6 - Routerlink 不起作用,但如果我在 url 中输入路径,我可以转到视图
- php - PHP 如何访问数据库并使用 $db->* 进行查询
- firebase - Codeship + Firebase 功能:config:set = 404 方法未找到
- r - 为什么 R 中核密度估计的积分平方误差的 ECDF 不是从 0 开始
- c++ - 如何系统地更新我曾经从二进制文件手动安装的 C++ 依赖项
- python - Python - 使用套接字将数据发送到网络上的每个 IP 地址
- python - 在保留数据的同时将 Django 外键移动到另一个模型?
- android - 在 Android 中从外部关闭 chrome 自定义选项卡