nodejs library to listen incoming mail
JavaScript
Switch branches/tags
Nothing to show
Pull request Compare This branch is 3 commits ahead, 39 commits behind jcreigno:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
sample
README.md
index.js
package.json

README.md

mail-notifier

Notify your nodejs scripts of incoming imap mail.

introduction

Send mail event for each new email in IMAP INBOX.

synopsis

Start listening new mails :

var notifier = require('mail-notifier');

var imap = {
  username: "yourimapuser",
  password: "yourimappassword",
  host: "imap.host.com",
  port: 993, // imap port
  secure: true // use secure connection
};

notifier(imap).on('mail',function(mail){console.log(mail);}).start();

installation

$ npm install mail-notifier

API

notifier(config)

The constructor function creates a new notifier. Parameter provide options needed for imap connection. config :

  • host : imap server host
  • port : imap server port number
  • username : imap user name
  • password : imap password
  • secure : need secure connection to server

.start()

Start listening for incomming emails.

.stop()

Stop listening and close IMAP connection.

Events

'mail'

Sent on incoming new unread email. The parsed Mail is given as first parameter to the event listener.

'error'

Sent when an error occurs with the IMAP connection. The first parameter is the err object.

'end'

Sent when the IMAP connection is closed. This usually happens after a stop method call.

Dependencies

This module relies heavily on node-imap.