Sending raw HTML to email hoganjs template via nodejs gives raw HTML output on email client

259 Views Asked by At

I have an angular front end app that sends a http POST request with the following raw HTML as body :

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

My nodejs backend is sending it using sendgrid and I am using HoganJs for templating as well.

But I was receiving this on my email.

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

There are 1 best solutions below

5
Iceman On BEST ANSWER
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
});