2016-07-16 80 views
1

我有发送httpPOST请求与以下原料HTML作为主体的角前端应用上原始HTML输出:发送原始HTML电子邮件hoganjs模板通过的NodeJS给电子邮件客户端

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

nodejs后端正在使用sendgrid发送它,我也使用HoganJs进行模板化。

但我收到我的电子邮件。

enter image description here

UPDATE

nodejs-sendgrid

sendgrid.send({ 
    to:  req.body.mail.email || "", 
    replyto: "[email protected]", 
    from:  "[email protected]", 
    subject: req.body.mail.subj, 
    html:  template.render(req.body.mail), 
}, function(err, json) { 
    // do something 
}); 
+0

你能显示你的Node.js代码。具体来说就是发送函数和调用。就像Sendgrid Node.js助手库,如果你使用它 – Iceman

+0

嗯,我只是发送原始字符串'req.body.mail.body'到'template.render(req.body.mail);'@Iceman – CENT1PEDE

+0

帮手有一个setHtml。它打破了正确的标题! – Iceman

回答

1
sendgrid.send({ 
    to:  req.body.mail.email || "", 
    replyto: "[email protected]", 
    from:  "[email protected]", 
    subject: req.body.mail.subj, 
    html:  "<b>Hello World</b>", 
}, function(err, json) { 
    // do something 
}); 
+0

但我已经在使用'html:template.render()' – CENT1PEDE

+0

@TheGreenFoxx刚刚看到您的编辑。 – Iceman

+0

奇怪的权利?你能想到另一种方式吗? – CENT1PEDE

相关问题