catch-all
v0.0.1
Published
A simple smtp catch all
Downloads
2
Readme
catch-all
A simple smtp-catch-all for your tests (node.js).
install
$ npm install catch-all
Usage
Simple usage:
var smtpCatchAll = require('..');
var server = smtpCatchAll.createServer();
server.on('newEmail', function (email) {
console.log(email);
});
server.listen(4040);
Accessing the envelope:
var smtpCatchAll = require('..');
var server = smtpCatchAll.createServer();
server.on('newEmail', function (email, envelope) {
console.log(envelope);
});
server.listen(4040);
catch-all is based on simplesmtp. You can pass same options to createServer
The returned server
is also an instance of simplesmtp. You can listen to the same events
In the same way.
Email format
Email is just a simple json email like:
{ text: 'cuentame lo k ase',
headers:
[ { name: 'x-mailer',
value: 'Nodemailer (0.5.3; +http://www.nodemailer.com/)' },
{ name: 'date', value: 'Tue, 12 Nov 2013 19:48:53 GMT' },
{ name: 'message-id',
value: '<1384285733880.5b4d56c9@Nodemailer>' },
{ name: 'from', value: '[email protected]' },
{ name: 'to', value: '[email protected]' },
{ name: 'subject', value: 'ola k ase' },
{ name: 'content-type', value: 'text/plain; charset=utf-8' },
{ name: 'content-transfer-encoding', value: 'quoted-printable' },
{ name: 'mime-version', value: '1.0' } ],
subject: 'ola k ase',
messageId: '1384285733880.5b4d56c9@Nodemailer',
priority: 'normal',
from: [ { address: '[email protected]', name: '' } ],
to: [ { address: '[email protected]', name: '' } ],
date: Tue Nov 12 2013 20:48:53 GMT+0100 (CET) }