How to install MailHog on Laravel Forge (Abbreviated Guide)


MailHog is a fantastic utility for intercepting email on a hosted server and popular with the Laravel community. Alternatives for MailHog exists, e.g.:

Our recommendation is if you’re developing locally to use HELO due to it’s superior Laravel integration, for example it’s ability to show the view blades in the debug tab.

But what do you do when you want to catch mail on a Forge server? This guide is designed to give you a quick path for doing that. The guide consists of installing the software, creating a new Linux systemd service, and then adjusting the Forge firewall to make it work.


This must be performed as root

sudo apt-get -y install golang-go
go get

The default installation needs root and will install the MailHog binary in ~/go/bin/MailHog

To get it running on every startup, do the following two things:

1. Create a new systemd service

cat >/etc/systemd/system/mailhog.service <<EOL
Description=MailHog service



2. Enable automatic startup for systemd service

systemctl enable mailhog

Starting Mailhog

You can now use systemctl start mailhog to start MailHog or systemctl status mailhog to see if it worked.

What Ports Do MailHog Use?

MailHog uses port 1025 for SMTP and port 8025 for it’s HTTP interface. These must be allowed on the Forge firewall before it will work.

Forge Firewall Configuration

Below is a screenshot of the Laravel Forge firewall configuration. Be sure to add both ports 1025 and 8025 to the Forge configuration.

Laravel Forge MaliHog SMTP Firewall Configuration Screenshot


Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top