通过 nodejs 将原始 HTML 发送到电子邮件 hoganjs 模板会在电子邮件客户端上提供原始 HTML 输出
Sending raw HTML to email hoganjs template via nodejs gives raw HTML output on email client
我有一个 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
});
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
});
我有一个 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
});
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
});