Pass variable to html template in nodemailer
<p>I want to send email with nodemailer using html template. In that template I need to inject some dynamically some variables and I really can't do that. My code:</p>

<pre><code>var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');

smtpTransport = nodemailer.createTransport(smtpTransport({
    host: mailConfig.host,
    secure: mailConfig.secure,
    port: mailConfig.port,
    auth: {
        user: mailConfig.auth.user,
        pass: mailConfig.auth.pass
    }
}));
var mailOptions = {
    from: 'my@email.com',
    to : 'some@email.com',
    subject : 'test subject',
    html : { path: 'app/public/pages/emailWithPDF.html' }
};
smtpTransport.sendMail(mailOptions, function (error, response) {
    if (error) {
        console.log(error);
        callback(error);
    }
});
</code></pre>

<p>Let's say I want in emailWithPDF.html something like this:</p>

<pre><code>Hello {{username}}!
</code></pre>

<p>I've found some examples, where was smth like this:</p>

<pre><code>...
html: '&lt;p&gt;Hello {{username}}&lt;/p&gt;'
...
</code></pre>

<p>but I want it in separate html file. Is it possible?</p>