javascript - 通过 Nodejs 将原始 HTML 发送到电子邮件 hoganjs 模板,从而在电子邮件客户端上提供原始 HTML 输出

标签 javascript html angularjs node.js hogan.js

我有一个 Angular 前端应用程序,它发送 http POST使用以下原始请求 HTML作为正文:

<h1>Hello World</h1><ol><li>Yo</li><li>Bro</li></ol>

我的nodejs后端正在使用 sendgrid 发送它我正在使用 HoganJs也用于模板。

但我在电子邮件中收到了此消息。

enter image description here

更新

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
});

最佳答案

sendgrid.send({
    to:       req.body.mail.email || "",
    replyto: "someemail@gmail.com",
    from:     "someemail@gmail.com",
    subject:  req.body.mail.subj,
    html:     "<b>Hello World</b>",
}, function(err, json) {
    // do something
});

关于javascript - 通过 Nodejs 将原始 HTML 发送到电子邮件 hoganjs 模板,从而在电子邮件客户端上提供原始 HTML 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38407569/

相关文章:

php - 为什么我的 JS 代码在明显的循环中运行?

javascript - 将大数字字符串转换为数字

javascript - 使用 css 或 javascript 在 html 页面中阻止键盘输入

php - 如果无法解析为 XML,如何获取页面的 &lt;title&gt; 标签内容?

javascript - 使用 id 和名称在滚动时更改事件 anchor 标记

node.js - REST API 还是网络套接字?

angularjs - 测试失败,因为 AngularJS 没有及时初始化

javascript - 结合 $ 和 _ 以按数据值提取?

jquery - 在具有特定类的 td 内的所有复选框中,只应选中其中一个

javascript - 从 JavaScript 访问 List 类的扩展属性