node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »



npm version

A module for getting event based notifications containing new webmail for IITG webmail servers.


$ npm install iitg-webmail-notify


### Example

var Webmail = require('iitg-webmail-notify');
// Store user details in an object
var userDetails = {
  username : username, // Without
  password : password,
  mailServer: mailServer // Among 'teesta', 'disang', 'naambor', 'tamdil', 'dikrong'
  path: '', // specify relative folder where to save attachments
            // defaults to folder where this is called from
  debug: true // for extra output, defaults to false 
// Create new Webmail object
webmail = new Webmail(user);
// Pass a callback which will be called
// when a new mail is recevied in user's
// inbox. mail is an object as described below.
webmail.on('mail', function(mail) {
  // Can user socket emitter event here
  // For example:
  // socket.emit('webmail', mail);
// Catch error event.
webmail.on('error', function(error) {

Data types

  • mail is an object representing the newly received webmail, and has the following properties:
    • from - object - The sender of the mail. Contains two entries.
      • email - string - The email of the sender
      • name - string - The name of the sender
    • to - array - The receivers of the mail. Each entry is an object with email and name, as described above.
    • date - date - The internal server date for the mail.
    • subject - string - The subject of the mail.
    • text - string - Plain text body of the mail.
    • textAsHtml - string - The plaintext body of the message formatted as HTML.
    • attachments - array - Array of objects containing name and path of each attachment.


  • Attachments
  • Filtering
  • Tests


The MIT License (MIT). Please see License File for more information.