@dadi/nodemailer-browser-transport
v1.0.1
Published
Preview your Nodemailer emails in your browser.
Downloads
26
Readme
Nodemailer Preview Transport
Preview your Nodemailer emails in your browser (Inspired by Letter Opener).
Usage
Install via NPM
$ npm install @dadi/nodemailer-browser-transport
Use it with Nodemailer
const nodemailer = require('nodemailer') const nodemailerBrowser = require('@dadi/nodemailer-browser-transport') let tmpdir = require('path').join(process.cwd(), 'tmp', 'nodemailer') let transport = new nodemailerBrowser({ dir: tmpdir, browser: true }) let mailer = nodemailer.createTransport(transport) mailer.sendMail({ from: '[email protected]', to: user.email, // cc:'[email protected]', // bcc:'[email protected]', subject: 'Hello', text: 'How are you?' }, function (err, info) { if (err) { console.log('Error: ' + err) } else { console.log('Response: ' + info) } }) }
Any emails sent through the preview transport will be written to the
tmpdir
and opened in a browser (unlessbrowser
is set to false).