Laravel Forge Mailhog Cheat Sheet

Email

Source: https://github.com/mailhog/MailHog

This installation was done on Ubuntu 24.04

Installation

forge
sudo -i
apt -y install golang-go
go install github.com/mailhog/MailHog@latest
~/go/bin/MailHog &

You should see something like the following:

[1] 242137
root@magic:~# 2024/08/07 08:32:34 Using in-memory storage
2024/08/07 08:32:34 [SMTP] Binding to address: 0.0.0.0:1025
[HTTP] Binding to address: 0.0.0.0:8025
2024/08/07 08:32:34 Serving under http://0.0.0.0:8025/
Creating API v1 with WebPath:
Creating API v2 with WebPath:

Next navigate to your Forge server, Network, and add a firewall rule to allow port 8025 if you want to view stuff from the outside. Note: This is a security risk.

Next, install it as a service:

# cat /etc/systemd/system/mailhog.service
[Unit]
Description=MailHog service
[Service]
ExecStart=/root/go/bin/MailHog
[Install]
WantedBy=multi-user.target