
MailHog
A fake mail server for testing: catches outgoing email and shows it in a web inbox.
- Stars
- 16.2k
- Forks
- 1.2k
- Licence
- MIT
- Language
- Go
- Last update
- 2.7 years ago
- Type
- Dev tool
No commits in over a year — check for forks or alternatives before adopting.
What it is
MailHog is a small testing tool that acts as a stand-in mail server during development. Your application sends email to it instead of a real provider, and MailHog stores those messages so you can view them in a web interface or fetch them through an API. It can also forward messages to a real SMTP server when you choose to.
- Point a local app's SMTP settings at port 1025 and view sent emails at port 8025
- Read captured messages in the web UI as plain text, HTML, or raw source
- Use the JSON API to list, retrieve, or delete messages in automated tests
- Release a captured message to a real SMTP server when you need to test real delivery
Great for
- Developers testing sign-up, password reset, or notification emails locally
- QA or teams who want to inspect outgoing email without sending it to real inboxes
- Projects that need an automated way to check sent messages through the HTTP API
- Anyone who wants a simple alternative to heavier mail testing setups
Not ideal for
- Production email delivery, since MailHog is a testing tool and does not deliver mail to real recipients by default
- People who need persistent, large-scale mail storage; the README lists in-memory storage by default, with MongoDB or file storage as options
- Teams needing active maintenance guarantees, since the last push shown is February 2024 and the README references older Go versions
How to get it
- 1
Install with a package manager
You'll need: Homebrew (macOS) or Go 1.17+ for the go install route
macOS install via Homebrew
brew update && brew install mailhogGo install (Go 1.17 or newer)
go install github.com/mailhog/MailHog@latest - 2
Run it
- Install MailHog using one of the README methods
- Start it by running `mailhog` in a terminal (or the path to the MailHog binary)
- Configure your application to send SMTP to the MailHog host on port 1025
- Open the web interface on port 8025 to view captured messages
- 3
Get the most out of it
- Use the HTTP API (APIv1 and APIv2 docs are linked in the README) to check messages in automated tests
- Enable HTTP basic authentication for the UI and API using the linked Auth guide
- Use the Chaos Monkey feature (Jim) to test how your app handles mail failures
- Use mhsendmail or `MailHog sendmail` to act as a sendmail replacement, for example with PHP's sendmail_path
Downloads
Strengths
- Simple setup with defaults: SMTP on port 1025 and web UI on port 8025
- Runs as a single portable binary with no installation required, per the README
- Supports both a web UI and an HTTP API for checking messages
Trade-offs
- Default in-memory storage means captured messages are lost when it stops
- The README's build and install notes reference older Go versions and the last push shown is from 2024
- Documentation is brief in the README, so advanced options require reading linked docs
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| MailHog (this) | 16.2k | Dev tool | beginner | 2.7 years ago | Developers testing sign-up, password reset, or notification emails locally |
| mailpit | 10.8k | Dev tool | beginner | 4 days ago | Developers testing signup, password reset, or notification emails locally |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.