1. Prerequisites
ElasticInbox requires:
- The most recent update of Java 7 (minimum is Java 6)
- Cassandra single or multi-node deployment running version 1.2.x (minimum supported version currently is 1.1.x; version 2.x is not fully tested yet). In this setup Cassandra cluster name is “Test Cluster”.
2. Installation
Download and unpack latest release:
wget https://github.com/elasticinbox/elasticinbox/releases/download/0.4.0/elasticinbox-0.4.0-bin.tar.gz
tar zxf elasticinbox-0.4.0-bin.tar.gz
cd elasticinbox-0.4.0
Initialize ElasticInbox keyspace:
Connected to: "TestCluster" on localhost/9160
Welcome to Cassandra CLI version 1.2.3
...
[default@unknown] create keyspace ElasticInbox
... with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
... and strategy_options = {replication_factor:1};
Initialize ElasticInbox column families (Note: remove all comments from config/elasticinbox.cml before running following command):
3. Configuration
To setup ElasticInbox with local filesystem as blob storage update following fields in the config/elasticinbox.yaml:
blobstore_profiles:
fs-local:
provider: filesystem
endpoint: /opt/elasticinbox-0.4.0
container: blobs
Create local folders for blobs (as per config/elasticinbox.yaml above), logs (see config/logback.xml) and temporary files (see bin/elasticinbox):
mkdir -p /var/log/elasticinbox
mkdir -p /var/tmp/elasticinbox
4. Starting up
Start application as background process:
If successful, you should see logs:
5. Interacting with REST
This is very simple example showing how you can store and retrieve messages using REST API.
Note: By default RESTful APIs are accessible on port 8181. You can change this from config/jetty.xml
1. Initialize new account:
Response:
Location: http://localhost:8181/rest/v2/mydomain.tld/user/mailbox
2. Store message in the Inbox (Label=1)
-T testmail.eml
Response:
Location: http://localhost:8181/rest/v2/mydomain.tld/user/mailbox/message/e5031a10-f81d-11df-a88e-080027267700
{"id":"e5031a10-f81d-11df-a88e-080027267700"}
3. Get pre-parsed message (served from Cassandra):
"http://localhost:8181/rest/v2/mydomain.tld/user/mailbox/message/e5031a10-f81d-11df-a88e-080027267700"
Response:
Content-Type: application/json
{
"message": {
"labels": [0, 1],
"size": 1123,
"date": "2010-11-24T22:55:12.000+0000",
"subject": "Hello World!",
"location": "blob://fs-local/e5031a10-f81d-11df-a88e-080027267700?c=dfl",
"from": [{
"address": "test@elasticinbox.com",
"name": "John Doe" }],
"to": [{
"address": "user@mydomain.tld",
"name": "My Name" }],
"htmlBody": "This is sample <u>html</u> message body.<br><br>-- EI<br>"
}
}
4. Get raw message (served from blob store):
"http://localhost:8181/rest/v2/mydomain.tld/user/mailbox/message/e5031a10-f81d-11df-a88e-080027267700/raw"
Response:
Content-Type: text/plain
Transfer-Encoding: chunked
Received: from mx02 (mx02 [127.0.0.1])
by mx02 (Postfix, from userid 48)
id AB80628CA95; Mon, 05 Dec 2011 09:53:50 -0800 (PST)
Date: Mon, 5 Dec 2011 21:53:48 +0400
To: =?utf-8?B?w4dhdGTEsXLEsWxtYWzEsSDDnG52YW4=?= <user@mydomain.tld>
From: =?utf-8?B?UsO8c3TJmW0gxo9saXlldg==?= <test@elasticinbox.com>
Subject: =?utf-8?B?VVRGOCBUZXN0IMO8w6fDvG4gbcO2dnp1IGZpa2lsyZnFn23JmW1pxZ/JmW0=?=
Message-ID: <3917ea5a412bc64e0c1f04d81ac2e5c6@elasticinbox.com>
...
For the complete REST API documentation visit api.elasticinbox.com.
6. Interacting with LMTP
Messages can be delivered using standard LMTP protocol.
Note: By default LMTP port is set to 2400 and can be changed from config/elasticinbox.yaml
You can use smtp-source application which usually ships with Postfix to test LMTP: