node package manager

eun-mailbox

eun-mailbox

Build Status XO code style License

eun-mailbox is a simple email client that uses IMAP.

Receiving new mail is as easy as mailbox.on('mail', doSomething)

Installation

npm:

npm install eun-mailbox

Usage

const Mailbox = require('./src/mailbox');
 
const credentials = {
  host: 'imap.gmail.com',
  user: 'omarchehab98@gmail.com',
  password: 'password'
};
 
const mailbox = new Mailbox(credentials);
 
mailbox.on('mail', mail => {
  console.log('mailbox has emitted "mail"\n', mail);
});

Events

  • connect
  • disconnect
  • mail
  • error

connect

Emitted when connected to the IMAP server.

disconnect

Emitted when disconnected from the IMAP server.

mail

Emitted when there is unseen mail.

{
  "from": "Omar Chehab <omarchehab98@gmail.com>",
  "subject": "Fwd: Large Transaction Warning",
  "date": "2017-02-19T20:45:32.000Z",
  "body": {
    "text": "Dead Omar,\nThank you for your response.\nRegards,\neun",
    "html": "<p>Dear Omar,</p><p>Thank you for your response.</p><p>Yours,</p><p><a href='https://github.com/omarchehab98/eun'>eun</a></p>"
  },
  "attachments": []
}

License

MIT © Omar Chehab