Skip to content

Instantly share code, notes, and snippets.

@v-jacob
Last active December 5, 2018 12:22
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save v-jacob/68caf7aeee53305a1ffa to your computer and use it in GitHub Desktop.
Save v-jacob/68caf7aeee53305a1ffa to your computer and use it in GitHub Desktop.
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
@gsouf
Copy link

gsouf commented Oct 28, 2016

@albionbrown
Copy link

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