Paperboy plugin for Nodemailer
Hey, this is a plugin for Nodemailer that renders email templates using Swig. Includes in templates works, images and attachments and other stuff to come in future. Inspired by nodemailer-express-handlebars. Find it NPM.
Install from NPM
npm install node-paperboy
Usage
var path = ;var paperboy = ; var options = viewPath: path extName: 'html' cidFolder: 'img' // Use the plugin with the Nodemailer transport instance.transporter; var mail = from: 'from@foo.tld' to: 'to@foo.tld' subject: 'A good Email' template: 'TemplateFile.html' attachments: filename: 'test.ogg' content: '/where/is/my/file.ogg' transporter;
Plugin Options
The plugin expects the following options:
- viewPath (required) The path to the directory where your templates live.
- extName (optionnal) The extension of the template to use (defaults to 'html').
- cidFolder (optionnal) The folder who content image for template, must be present in same folder of templates
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 (optionnal) The data to pass to your email template.
- attachments (optionnal) An array of attachments file
License
MIT