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

时间:2016-07-16 03:57:39

标签: javascript html angularjs node.js hogan.js

我有一个有角度的前端应用,可以发送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
});

1 个答案:

答案 0 :(得分:1)

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