imap-server

IMAP Server module for Nodejs

Showing:

Popularity

Downloads/wk

2

GitHub Stars

73

Maintenance

Last Commit

8yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

8.2KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

imap-server

IMAP Server module for Nodejs

This project is inspired by Haraka a SMTP server for Nodejs. All features of an IMAP server are implemented as plugins, so it can adapt to many use cases.

Installation

npm install imap-server

Usage

var ImapServer = require('imap-server');
var server = ImapServer();

// use plugin
var plugins = require('imap-server/plugins');
server.use(plugins.announce);
/* use more builtin or custom plugins... */

var net = require('net');
net.createServer(server).listen(process.env.IMAP_PORT || 143);

Plugins

Built-in plugins

announce

Required by IMAP4rev1. This plugin also send the optional capability list.

starttls

Provide encrypted communication for IMAP via the STARTTLS command.

server.use(plugins.starttls, {
    /* mandatory hash of options for crypto.createCredentials
     * http://nodejs.org/api/crypto.html#crypto_crypto_createcredentials_details
     * with at least key & cert
     */
    key: Buffer,
    cert: Buffer
});

debug

This plugin log various information.

authentification helper

Here's how to implement auth plain without worrying about the underlying protocol:

var WrapAuthPlain = require('imap-server/util/auth_plain_wrapper');

exports.auth_plain = WrapAuthPlain(function(connection, username, password, next) {
    if(username == "john.doe@example.com" && password == "foobar") {
        next(null, 'OK');
    }
    else {
        next(null, 'NO');
    }
});

Notes

  • Default port : 143

  • SSL port : 993

  • rfc3501 (IMAP4rev1) : http://tools.ietf.org/html/rfc3501

  • return flags : OK, NO, BAD

  • getCapabilities ( connection ) Sync, return [cap, ...]

  • register

  • connection ( connection, next )

  • starttls ( next )

  • auth_* ( next )

  • unknown_command ( connection, line, next )

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial