node-reply-worker
v0.1.3
Published
An email reply worker that listens to new emails and emits an event every time an email with an id arrives.
Downloads
2
Readme
node-reply-worker
An email reply worker that listens to new emails and emits an event every time an email with an id arrives.
This works with plus addressing, for example, if you have the email address [email protected]
, you can add +<something>
before the @ sign, like [email protected]
. Most mail servers support this feature, but if you are not sure, you can check by sending and email as described.
Install
npm install node-reply-worker --save
Usage
var ReplyWorker = require('node-reply-worker');
var inspect = require('util').inspect;
var worker = new ReplyWorker({
mailAddress: /* Your email address */,
mailPassword: /* Your email password */,
stripMessages: /* Removes replied messages and signatures */,
checkInterval: /* Interval in minutes to check for new messages, default: 10 */,
imapConnection: {
host: /* Server address */,
port: /* Server port, default: 993 */,
tls: /* Use tls, default: true */
}
});
worker.on('reply', function(res) {
/**
* res format:
* - id: <the part between + and @ of the email address>,
* - from: <from email address>,
* - text: <the mail text>
*/
console.log(inspect(res));
});
worker.start();