A plugin for nodemailer that uses express-handlebars view engine to generate emails
npm install nodemailer-handlebarsbash
npm install nodemailer-handlebars
`
Usage
`javascript
//reference the plugin
var hbs = require('nodemailer-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`