Skip to main content

MailHog

What is MailHog?

MailHog is an SMTP testing tool that catches outgoing dev email and shows it in a web UI instead of delivering it. It was one of the most widely used dev mail catchers for years, but the project has been effectively unmaintained since 2022. Laradock still ships it for existing setups, but new projects should prefer Mailpit, a modern, actively maintained, drop-in replacement written in Go.

Start MailHog

docker compose up -d mailhog

Stop MailHog

docker compose stop mailhog

This stops the container without deleting its data. To remove the container: docker compose rm -f mailhog.

Configuration

MailHog has no defaults.env, its ports are fixed directly in mailhog/compose.yml:

PortPurpose
1025SMTP, point your app's mail driver here.
8025Web UI, browse caught mail here.

Because these are hardcoded ("1025:1025" and "8025:8025"), there's no MAILHOG_*_PORT variable to override in .env. If you need a configurable port, use mailpit or maildev instead.

Connect your app

Open the web UI at http://localhost:8025. Point your app's SMTP settings at the mailhog container name (not localhost) on port 1025:

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null

Common issues

  • Mail isn't showing up in the UI. Confirm your app's .env uses MAIL_HOST=mailhog (the container name), not localhost or 127.0.0.1, those only resolve from your host machine, not from inside another container.
  • Port 1025 or 8025 already taken on your host. MailHog's ports aren't configurable via .env. Either free the port, or switch to mailpit or maildev, both of which expose MAILHOG-equivalent ports through env vars.
  • Considering MailHog for a new project. The upstream project is largely dormant. Use Mailpit instead, same idea, actively maintained, configurable ports.

Prefer the actively maintained successor? See Mailpit. New to Laradock? Start with Getting Started.