jofftiquez
jofftiquez

Reputation: 7708

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

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

Upvotes: 1

Views: 269

Answers (1)

Iceman
Iceman

Reputation: 6145

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

Upvotes: 1

Related Questions