node-email-templates render hack
node-email-templates is a neat add-on for Nodemailer which allows you to store and render HTML/Text. The only problem is that it requires a specific folder with 3 files in it (html.ejs, text.ejs and style.css).
Here is a tip for dynamic rendering:
var emailTemplates = require('email-templates');
var et = emailTemplates('.', function(err) {
et.render(
tpl_arguments,
'.',
tpl_html,
tpl_text,
tpl_css,
function(err, html, text) {
console.log(html, text);
});
});
Where tpl_html is the HTML template and so on...
Edit: Updated for email-templates 0.9
Written by Daniel Tralamazza
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Node
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#