MailHog logo

MailHog

Lightweight email testing tool with web UI and API

MailHog captures outgoing SMTP emails during development, letting you inspect messages in a web interface or via JSON API without sending to real recipients.

Overview

Email Testing for Developers

MailHog is a Go-based email testing tool designed to simplify SMTP testing during application development. It acts as a local SMTP server that captures all outgoing emails, preventing accidental sends to real recipients while providing full visibility into message content and structure.

Core Capabilities

Developers configure their applications to route SMTP traffic through MailHog's server (default port 1025). All captured messages appear instantly in a clean web interface (port 8025) with support for plain text, HTML, and raw source views. The tool includes a JSON API for programmatic access, enabling automated testing workflows. Messages can optionally be released to real SMTP servers when ready for delivery.

Built with Go, MailHog runs as a single binary with no installation dependencies across Windows, macOS, Linux, and FreeBSD. It supports modern SMTP standards including RFC5321, authentication (RFC4954), pipelining (RFC2920), and multipart MIME. Storage options include in-memory (default), MongoDB, or file-based persistence. The included Chaos Monkey feature helps test application resilience by simulating mail server failures.

Ideal For

MailHog suits development teams needing reliable local email testing, CI/CD pipelines requiring email verification, and anyone building applications with transactional email workflows.

Highlights

Zero-installation binary runs on multiple platforms without dependencies
Real-time web UI with EventSource updates and multipart MIME support
JSON API (v1/v2) for automated testing and message retrieval
Chaos Monkey failure testing and optional message release to real SMTP servers

Pros

  • Single binary with no runtime dependencies simplifies deployment
  • Supports modern SMTP standards including AUTH and PIPELINING
  • Multiple storage backends (in-memory, MongoDB, file-based) for flexibility
  • Active community with 15K+ GitHub stars and broad platform support

Considerations

  • In-memory default storage loses messages on restart
  • No built-in SSL/TLS termination for production-like testing scenarios
  • Limited advanced filtering or search capabilities in web UI
  • Project maintenance status unclear with zero open issues reported

Managed products teams compare with

When teams consider MailHog, these hosted platforms usually appear on the same shortlist.

Mailinator logo

Mailinator

Disposable email testing inboxes with public and private domains

Mailosaur logo

Mailosaur

Email & SMS testing with disposable inboxes and phone numbers

MailReach logo

MailReach

Email warm-up and spam testing to boost inbox placement

Looking for a hosted option? These are the services engineering teams benchmark against before choosing open source.

Fit guide

Great for

  • Local development environments needing quick email verification
  • CI/CD pipelines requiring automated email content testing
  • Teams testing transactional emails without risk of accidental sends
  • Developers needing sendmail replacement for PHP or other frameworks

Not ideal when

  • Production email delivery or high-volume message processing
  • Teams requiring advanced email analytics or long-term archival
  • Scenarios demanding enterprise authentication (LDAP, SSO)
  • Projects needing guaranteed active maintenance and support

How teams use it

PHP Application Testing

Configure php.ini to route sendmail through MailHog, inspect registration and password reset emails locally without external SMTP

CI/CD Email Verification

Use JSON API in automated tests to verify email content, headers, and attachments after triggering application workflows

Microservices Development

Run MailHog in Docker alongside service containers to capture all SMTP traffic in isolated development environments

QA Failure Testing

Enable Chaos Monkey to simulate SMTP server failures and verify application retry logic and error handling

Tech snapshot

Go69%
Makefile20%
Dockerfile12%

Frequently asked questions

Does MailHog require installation or dependencies?

No. MailHog is a single Go binary that runs without installation on Windows, macOS, Linux, and FreeBSD. Download and execute to start capturing emails immediately.

How do I configure my application to use MailHog?

Point your SMTP settings to localhost:1025 (default). For PHP, update php.ini with sendmail_path pointing to mhsendmail or use sendmail -S mail:1025.

Are captured emails stored permanently?

By default, messages are stored in-memory and lost on restart. Configure MongoDB or file-based storage for persistence across sessions.

Can I release emails to real recipients after testing?

Yes. MailHog allows you to selectively release captured messages to real SMTP servers directly from the web interface or API.

What ports does MailHog use?

SMTP server listens on port 1025 and the web UI/API runs on port 8025 by default. Both are configurable via command-line options.

Project at a glance

Dormant
Stars
15,675
Watchers
15,675
Forks
1,149
LicenseMIT
Repo age11 years old
Last commit2 years ago
Primary languageGo

Last synced yesterday