Nodejs library to get notified on new incoming email.

npm install mail-notifier
19 downloads in the last week
48 downloads in the last month


Notify your nodejs scripts of incoming imap mail.


Send mail event for each new email in IMAP INBOX.


Start listening new mails :

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

var imap = {
  user: "yourimapuser",
  password: "yourimappassword",
  host: "",
  port: 993, // imap port
  tls: true,// use secure connection
  tlsOptions: { rejectUnauthorized: false }



$ npm install mail-notifier



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

  • host : imap server host
  • port : imap server port number
  • user : imap user name
  • password : imap password
  • tls : need a tle connection to server
  • tlsOptions : see tls module options
  • markSeen: mark mail as read defaults to true
  • box : mail box read from defaults to 'INBOX'
  • search: search query defaults to ['UNSEEN']

For backward compatibility username is also supported.


Start listening for incomming emails.


Stop listening and close IMAP connection.



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


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


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


This module relies heavily on node-imap. For more advanced usage, please consider using it directly.

npm loves you