Skip to content
IMAP to REST interface.
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
lib
node_modules
.gitignore
.gitmodules
README.md
config.js
package.json

README.md

imap2rest

IMAP 2 REST interface.

Disclaimer

This is just a proof of concept. It's neither maintained nor supported. Use at your own risk!

What's implemented

curl http://localhost:8080/ && echo
["Chats","Contacts","Drafts","Emailed Contacts","INBOX","Junk","Sent","Trash"]

curl "http://localhost:8080/INBOX/search?since=November%201,%202011"
["790","791","792", ...skipped..., "852"]

curl "http://localhost:8080/INBOX/31337/headers"
{"content-type":["text/html; charset=UTF-8"],...}

curl "http://localhost:8080/INBOX/31337/body"
<A bunch of HTML>

Installation

git clone --recursive http://github.com/laggyluke/imap2rest.git
cd imap2rest
sudo npm link

Running

imap2rest is configured using following environment variables:

HTTP_HOST -- host to bind web server to (default: '0.0.0.0')
HTTP_PORT -- host and port to bind web server to (default: '8080')

IMAP_USERNAME -- IMAP username e.g. 'user@exampe.com'
IMAP_PASSWORD -- password for IMAP_USERNAME
IMAP_HOST -- IMAP server host (default: 'localhost')
IMAP_PORT -- IMAP server port (default: '143' or '993', depending on IMAP_SECURE)
IMAP_SECURE -- should we use SSL or not, (default: true)

You can specify these setting inline:

$ IMAP_USERNAME=foo IMAP_PASSWORD=bar imap2rest
Server started.

or, more conveniently, inside a shell script:

$ cat start.sh
#!/bin/bash
export IMAP_USERNAME=foo
export IMAP_PASSWORD=bar
imap2rest
$ ./start.sh
Server started.
Something went wrong with that request. Please try again.