Instantly share code, notes, and snippets.

What would you like to do?
Mailhog Bash Script
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog
# Make it executable
chmod +x ~/mailhog
# Make it start on reboot
sudo tee /etc/init/mailhog.conf <<EOL
description "Mailhog"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
exec su - vagrant -c "/usr/bin/env ~/mailhog > /dev/null 2>&1 &"
end script
# Start it now in the background
sudo service mailhog start

This comment has been minimized.

kalenjohnson commented Sep 16, 2015

Do you install this on the Vagrant box or on your host machine?


This comment has been minimized.

phroggyy commented Sep 28, 2015

@kalenjohnson: you can install it on your vagrant box and access it through your box's IP and port 8025


This comment has been minimized.


varghesejacob commented Sep 19, 2016

systemd version instead of upstart (Ubuntu 16.04 or greater)


This comment has been minimized.

gsouf commented Oct 28, 2016


This comment has been minimized.

joshbrown81 commented Mar 27, 2017

Tested this and works nicely (Ubuntu 14.04). Make sure to open port 8025 (if firewall present) and restart mailhog with sudo service mailhog restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment