express-mail-preview

1.0.1 • Public • Published

Express mail preview

Deprecated!! New project here: express-email

Render email by node-email-templates and show in web browser.

Usage

var preview = require('express-mail-preview');

if (app.get('env') === 'development') {
  var opts = {
    path: path_to_mail_dir, # for more, see node-email-templates
    locals: {billing_id: 123, user: 'tony'...}, # locals for render template
    cid: where_to_find_cid
  };
  app.get('/_mail/billing.html', preview(opts));    # preview html
  app.get('/_mail/billing.txt', preview(opts));     # preview text
}

If path end with .txt or .text, will show text, elsewise, show html.

  • opts.path: email template dir, see node-email-templates for more details

  • opts.locals: locals, for render template, see ejs, jade... for more details

  • opts.cid: where to find cid

    • null or undefined: search in opts.path
    • path: seach in path
    • {aaa: path_of_aaa, bbb: path_of_bbb...}: special as hash

Then, run app in development mode, access /_mail/billing.html and /_mail/billing.txt, you can view your email.

Readme

Keywords

none

Package Sidebar

Install

npm i express-mail-preview

Weekly Downloads

1

Version

1.0.1

License

BSD-3-Clause

Last publish

Collaborators

  • pjincz