Public | Automated Build

Last pushed: 2 years ago
Short Description
MailHops is an email route API.
Full Description

MailHops API

<img src="images/mailhops395.png" width="200" alt="MailHops logo" title="MailHops" align="right" />

MailHops is an email route API. It does two things:

  1. Returns a route an email took based on the Received header IP addresses
  2. Returns a map an email took based on the Received header IP addresses

The route will contain DNSBL lookup results, hostname lookup results, what3words geo locations and the current weather of the senders location.

Install From Docker

docker pull avantassel/mailhops-api
docker run --name mailhops -p 8080:80 avantassel/mailhops-api

Docker Build Notes

Install the Docker Toolbox

docker build .

# copy Image Id
docker images

# run container for mailhops with php-fpm network
docker run --name mailhops -p 8080:80 [Image Id]

# get your Docker IP
docker-machine ip default

# SSH into the container
docker exec -t -i mailhops /bin/bash

Now open your browser to http://[Docker Ip]:8080

Install From Ansible and deploy to AWS

brew install ansible
ansible-galaxy install avantassel.php7.ansible.role geerlingguy.letsencrypt

ansible-playbook -i Ansible.inventory

Install From Scratch

Get the geoip file, install composer, pear, node, npm and php 5.5 or greater

# get the geoip binary file from MaxMind
mkdir geoip

curl -sS | php
mv composer.phar /usr/local/bin/composer
composer install

curl -O
sudo php -d detect_unicode=0 go-pear.phar
sudo pear install Net_DNSBL

# PHP 5.5 Update (AWS)
yum remove php*
yum remove httpd.x86_64 httpd-devel.x86_64 httpd-tools.x86_64

# install web server
yum install nginx
# OR
yum install httpd24.x86_64 httpd24-devel.x86_64 httpd24-tools.x86_64

cat nginx.conf >> /etc/nginx/conf.d/mailhops.conf

yum install php55.x86_64 php55-common.x86_64 php55-devel.x86_64 php55-fpm
yum install nodejs npm --enablerepo=epel

# make sure httpd starts on boot
chkconfig httpd on
chkconfig nginx on
chkconfig php-fpm-5.5 on

/etc/init.d/httpd start
# OR
/etc/init.d/nginx start
/etc/init.d/php-fpm-5.5 start

Setup the GeoIP cron job

MaxMind updates on the first Tuesday of the month so lets run this at midnight on the first Wednesday

0 0 *  * 3 /path/to/

Setup map dependencies

npm install -g bower
npm install


options are set in the config.json file

mv config.sample.json config.json


Add connection info in config.json

# install the mongo PHP driver
pecl install mongo

# add to the php.ini
# php5 now stores it in
vim /etc/php-5.5.ini

# install default collections
mongorestore -h [host:port] -d mailhops -u [user] -p [pass] v1/mongo/mailhops/


Add API key in config.json

Add API key in config.json

If running locally, test it out with

You may want to use OpenDNS if running locally, there are issues with Google DNS servers.

php -S -t .

Plugins for Postbox and Thunderbird

Docker Pull Command
Source Repository