A plugin for nodemailer that uses express-handlebars view engine to generate emails
JavaScript HTML
Latest commit ee55810 Sep 23, 2016 @yads committed on GitHub Update README.md
Permalink
Failed to load latest commit information.
lib rename values to context Nov 13, 2014
test rename values to context Nov 13, 2014
.gitignore initial implementaton Nov 13, 2014
README.md Update README.md Sep 23, 2016
index.js make plugin more modular Nov 13, 2014
package.json version bump Mar 8, 2016

README.md

Express Handlebars plugin for Nodemailer

This plugin works with nodemailer 2.x. And uses the express-handlebars view engine to generate html emails.

Install from npm

npm install nodemailer-express-handlebars

Usage

//reference the plugin
var hbs = require('nodemailer-express-handlebars');
//attach the plugin to the nodemailer transporter
transporter.use('compile', hbs(options));
//send mail with options
var mail = {
   from: 'from@domain.com',
   to: 'to@domain.com',
   subject: 'Test',
   template: 'email',
   context: {
       name: 'Name'
   }
}
transporter.sendMail(mail);

Plugin Options

The plugin expects the following options:

  • viewEngine (required) either the express-handlebars view engine instance or options for the view engine
  • viewPath (required) provides the path to the directory where your views are
  • extName the extension of the views to use (defaults to .handlebars)

Mail options

Set the template and values properties on the mail object before calling sendMail

  • template the name of the template file to use
  • context this will be passed to the view engine as the context as well as view engine options see here

License

MIT