Skip to content

Stream incoming IMAP or Exchange/EWS mail in Node.js.

License

Notifications You must be signed in to change notification settings

demarius/mailstream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mail-stream

nodejs imap mail stream wrapper

Get notified of mailbox updates - inbox, outbox, etc.

Requirements

  • node.js -- v0.10.0 or newer
  • An IMAP or EWS server

Installation

npm install mailstream

IMAP

var MailStream = require('mailstream')

MailStream({
    imap: {
        user: '[email protected]',
        password: 'm@1lstr3@m%',
        host: 'imap.gmail.com',
        port: 993,
        tls: true
    },
    filter: function (mail) { // Optional.
        //mail parsed through MailParser.

        return mail.headers['in-reply-to'] == 'header-value'
    },
    box: 'INBOX' // Optional. Can be 'OUTBOX', 'DRAFTS', etc.
}, function (error, mailstream) {
    mailstream.on('data', function (mail) {
        console.log(mail)
    })

    process.on('SIGINT', function () {
        console.log('\nAbout to exit.')
        mailstream.disconnect()
        console.log('Got mails until '+mailstream.since)
        process.exit()
    })
})

About

Stream incoming IMAP or Exchange/EWS mail in Node.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published