Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mailhog Bash Script
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# 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]
respawn
pre-start script
exec su - vagrant -c "/usr/bin/env ~/mailhog > /dev/null 2>&1 &"
end script
EOL
# Start it now in the background
sudo service mailhog start
@kalenjohnson

This comment has been minimized.

kalenjohnson commented Sep 16, 2015

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

@phroggyy

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

@varghesejacob

This comment has been minimized.

Owner

varghesejacob commented Sep 19, 2016

systemd version instead of upstart (Ubuntu 16.04 or greater)

https://gist.github.com/varghesejacob/c31a844042ca5ced6b72ccab3cd6055b

@gsouf

This comment has been minimized.

gsouf commented Oct 28, 2016

@joshbrown81

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