1.0.1 • Published 9 years ago
express-mail-preview v1.0.1
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 detailsopts.locals
: locals, for render template, seeejs
,jade
... for more detailsopts.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.