【发布时间】:2016-11-19 08:10:10
【问题描述】:
我有一个 Angular 前端应用程序,它发送一个 http POST 请求,其中包含以下原始 HTML 作为正文:
<h1>Hello World</h1><ol><li>Yo</li><li>Bro</li></ol>
我的nodejs 后端使用sendgrid 发送它,我也使用HoganJs 进行模板。
但是我在我的电子邮件中收到了这个。
更新
nodejs-sendgrid
sendgrid.send({
to: req.body.mail.email || "",
replyto: "someemail@gmail.com",
from: "someemail@gmail.com",
subject: req.body.mail.subj,
html: template.render(req.body.mail),
}, function(err, json) {
// do something
});
【问题讨论】:
-
你能展示你的 Node.js 代码吗?特别是发送函数和调用。如果您使用 Sendgrid Node.js 帮助程序库,就像使用它一样
-
好吧,我只是将原始字符串
req.body.mail.body发送到template.render(req.body.mail);@Iceman -
助手有一个setHtml。它设置了正确的标题!
标签: javascript html angularjs node.js hogan.js