1.0.4 • Published 7 years ago

iitg-webmail-notify v1.0.4

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

iitg-webmail-notify

npm version

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

Installation

$ npm install iitg-webmail-notify

Usage

Example

var Webmail = require('iitg-webmail-notify');
....

// Store user details in an object
var userDetails = {
  username : username, // Without @iitg.ernet.in
  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) {
  console.log(mail)
  // Can user socket emitter event here
  // For example:
  // socket.emit('webmail', mail);
})

// Catch error event.
webmail.on('error', function(error) {
  console.log(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.

TODO

  • Attachments
  • Filtering
  • Tests

License

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

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago