Friday 5 May 2017

HTML file as a variable in Node.js

I need to send something as a html via email (I'm using Sendgrid) with simple Node.js server. I'm just sending some text with variables in them and line breaks.

var postData = 'lat: ' + formatted.latitude + '<br>lng: ' + formatted.longitude + '<br>time: ' + formattedDate;
sendEmail(postData);

Then I'm sending the email with Sendgrid as a HTML.

var content = new helper.Content('text/html', messageContent);

No need to paste remaining blocks of code.

What I need is more complex .html file with css and javascript in it. Moreover I need to change some values in it. What is the easiest way to assign this file to variable and send it like this?



via codddeer123

No comments:

Post a Comment