Forked from bouassaba/Mailhog Bash Script (systemd)
Last active
December 17, 2024 13:43
-
-
Save erral/c7ff9b6b40aa75b0f10a701ec9fc9e4c to your computer and use it in GitHub Desktop.
Mailhog setup with systemd. Copy and paste this to a terminal in your computer. It will start a MailHog server listening on port 25 and a web based interface listening on port 8025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo ">>> Installing Mailhog" | |
# Download binary from github | |
sudo wget --quiet -O /usr/local/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64 | |
# Make it executable | |
sudo chmod +x /usr/local/bin/mailhog | |
# Make it start on reboot | |
sudo tee /etc/systemd/system/mailhog.service <<EOL | |
[Unit] | |
Description=MailHog Service | |
After=network.service vagrant.mount | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/env /usr/local/bin/mailhog -smtp-bind-addr :25 -storage maildir > /dev/null 2>&1 & | |
[Install] | |
WantedBy=multi-user.target | |
EOL | |
# Start on reboot | |
sudo systemctl enable mailhog | |
# Start background service now | |
sudo systemctl start mailhog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment