DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Pass variable to html template in nodemailer

What you can do is read the HTML file using fs module in node and then replace the elements that you want changed in the html string using handlebars

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var handlebars = require('handlebars');
var fs = require('fs');

var readHTMLFile = function(path, callback)

Top comments (0)