No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Access your email via a RESTful web API.


Setup haraka server to receive mail

Begn by create a droplet on digital ocean. Name it mail and make it 512 RAM. I choose San Francisco because that is nearest me. Make it Ubuntu 12.04 x64.

Cool, now ssh in.


Install vim

apt-get remove vim-tiny
apt-get install vim

Install git

apt-get install git-core

Set the root user's password.


Restart ssh after that.

service ssh restart

Add a user.

adduser yourusername

Give the user privileges.


Add the following.

root    ALL=(ALL:ALL) ALL
yourusername ALL=(ALL:ALL) ALL

Next to be extra safe let's change the ssh rules.

vim /etc/ssh/sshd_config

Set or add the following settings in that sshd_config file.

Port 25999
PermitRootLogin no
AllowUsers yourusername

Restart ssh.

service ssh restart

Ok, logout and login as the yourusername user.

ssh yourusername@IPADDRESS

Install oh-my-zsh

sudo apt-get update && sudo apt-get install zsh
curl -L | sh
chsh -s /bin/zsh

Install vundle.

git clone ~/.vim/bundle/vundle

Set your ~/.vimrc to look like the following.

Launch vim and run :BundleInstall.

Now, install redis.

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install tcl8.5

Download redis (latest at writing was 2.6.16).

tar xzf redis-2.6.16.tar.gz
cd redis-2.6.16
make test
sudo make install
cd utils
sudo ./

Now start and stop it as you need.

sudo service redis_6379 start
sudo service redis_6379 stop

Now we can setup haraka.

Install nodejs.

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Then setup haraka.

sudo npm install -g Haraka
sudo haraka -i /etc/haraka

Comment out all the plugins in /etc/haraka/config/plugins.

sudo vim /etc/haraka/config/plugins

Add data.redis to the end of /etc/haraka/config/plugins.


Setup the haraka-redis js plugin.

cd /etc/haraka/plugins
sudo npm install -g redis
sudo npm install -g microtime
sudo npm install -g redis-wstream
sudo wget
cd ..
sudo haraka -c .

Edit haraka to daemonize by default.

sudo vim /etc/haraka/config/smtp.ini

Uncomment the daemonize=true line as well as the log and pid file locations.

Start the haraka service

sudo haraka -c /etc/haraka

Click here for more detailed haraka install instructions.

All done, now you have a mail server accepting mail and dumping it into a redis database.

Exit your server and let it run.

Deploy mailtub to heroku

Before you do the following, you will need an account on heroku and have already installed the heroku toolbelt.

git clone
cd mailtub
heroku create
git push heroku master
heroku run rake db:migrate
heroku config:set REDIS_URL=redis://ipaddress_of_above_mail_server:6379
heroku addons:add scheduler:standard

In the scheduler add the following to run every 10 minutes.

bundle exec rake sync



GET /sync.json

GET /raw_emails/index.json

GET /emails/index.json