Self-host MailHog
v1.0.1Email capture and testing server for developers
- Stars
- 16 207
- Ports
- 1025 (SMTP server that receives the test mail your application sends), 8025 (HTTP server for the web UI and the JSON API)
mailhog/mailhogWhat is MailHog?
MailHog is a small SMTP server that developers run locally to catch the mail their application sends instead of delivering it to a real inbox. Captured messages are browsable in a web UI where they can be read as plain text, HTML or raw source, with live updates pushed to the browser and individual MIME parts downloadable; a JSON HTTP API exposes the same messages for listing, retrieving, downloading and deleting. Mail can be released onward to a real SMTP server, chosen in the UI or defined permanently in a JSON file of outgoing servers. For failure testing, the built-in Chaos Monkey called Jim randomly disconnects sessions, rate-limits links or rejects senders, recipients and authentication, each with its own tunable probability. Storage defaults to memory, with a Maildir directory or MongoDB available when messages must persist, and the UI and API can be locked behind HTTP basic auth using a bcrypt password file. Written in Go, it needs no installation: run a downloaded binary, a Homebrew or FreeBSD package, or the mailhog/mailhog container image exposing 1025 and 8025. It is a mail-testing tool rather than a production mail server, and no release has shipped since v1.0.1 in 2020.
MailHog alternatives
maildevSelf-hosted SMTP server for development email testing with modern web inbox, REST API, dark mode, and MCP support.Comparemaildev with MailHog
InbucketSelf-hosted disposable webmail server for testing email functionality, with built-in SMTP, POP3, and REST interfaces — no external database required.CompareInbucket with MailHog
posthornSelf-hosted email gateway bridging apps to transactional providers (Postmark, Resend, Mailgun, AWS SES, SMTP) with HTTP form, API, and SMTP ingress.Compareposthorn with MailHog
PostalPostal is an open-source mail delivery platform you self-host for transactional e-mail, with SMTP and HTTP sending, DKIM signing, webhooks and incoming mail routing.ComparePostal with MailHog
MoxOpen-source, self-hosted all-in-one email server with SMTP, IMAP4, webmail, junk filtering and automatic ACME TLS, set up for your own domain via quickstart.CompareMox with MailHog
rustmailerSelf-hosted email middleware unifying IMAP, SMTP, Gmail and Graph APIs into REST/gRPC with web client, webhooks, NATS, OAuth2. Single binary, no external deps.Comparerustmailer with MailHog
mailcueMailCue is a self-hosted, open-source email testing server with Postfix, Dovecot, DKIM, DMARC, SpamAssassin, REST API, and React UI in one Docker container.Comparemailcue with MailHog
bunmailBunMail is a self-hosted, open-source transactional email API with REST API, dashboard, DKIM, queue, templates, webhooks, and inbound SMTP — free alternative to SendGrid.Comparebunmail with MailHog
Should you self-host MailHog?
MailHog scores 67/100 on selfhost.directory (how scoring works) and ranks #10 of 109 in Email. It has 16 207 GitHub stars, +25 in the last 30 days.
There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.
Setup is easy: most people get it running in one sitting. An official Docker image is available. It is MIT-licensed and written mostly in Go.
Its closest alternative on selfhost.directory is Listmonk (80/100, 24 290 stars). It scores higher overall, so compare the two before you pick. See MailHog vs Listmonk side by side.
Features
- Chaos testing
- CORS for API endpoints
- Customisable bind addresses and web path
- HTTP Basic Authentication
- Message persistence backends
- MIME part downloads
- MIME Support
- Outgoing mail release
- Real-time updates
- REST API
- Sendmail replacement mode
- SMTP AUTH and PIPELINING
- SMTP capture server
- Web UI message viewer
MailHog README
Inspired by MailCatcher, easier to install.
- Download and run MailHog
- Configure your outgoing SMTP server
- View your outgoing email in a web UI
- Release it to a real mail server
Built with Go - MailHog runs without installation on multiple platforms.
More in Email
Mail-in-a-BoxOpen-source, self-hosted mail server appliance: one script turns a fresh Ubuntu 22.04 VPS into a full mail stack with webmail, spam filtering, DNS and a control panel.
MailnesiaMailnesia is a self-hosted disposable email service that auto-clicks registration links, supports aliases and alternate domains, and provides RSS feeds per mailbox.
MailpileSelf-hosted webmail with PGP encryption. Custom search organizes email using tags. Open-source alternative to commercial email.
MailpitAn open-source SMTP mail catcher for developers: a self-hosted single binary or Docker image with a web UI, REST API, POP3 server and HTML, link and spam checks.
mailriseMailrise is a self-hosted, open-source SMTP server that transforms emails into Apprise notifications for 60+ services like Matrix, Nextcloud, and mobile push.
mailspring-apiSelf-hosted API server replacing Mailspring's official sync backend, enabling metadata sync, read receipts, link tracking, and scheduled sending for the email client.
mailtrainSelf-hosted newsletter app for email marketing. Built on Node.js with MySQL/MariaDB, MongoDB, Redis. Features subscriber lists, segmentation, MJML templates.
MailuSelf-hosted open-source Docker-based mail server providing IMAP/SMTP services, webmail access, and admin interface. Replaces complex groupware setups.
MauticA self-hosted, open-source marketing automation platform: email campaigns, lead nurturing, landing pages, web tracking, plus a REST API and webhooks.
mbox-web-viewerA self-hosted, open-source Node.js tool that serves a web interface for browsing mbox email files, watching for live changes and supporting multiple email addresses.
MillionSendSelf-hosted email platform sending via your AWS SES with Resend-compatible API, dashboard, SMTP relay, webhooks, and broadcast campaigns.
mlmmjmlmmj is a simple, lightweight, and efficient mailing list manager inspired by ezmlm, designed for easy integration with various Mail Transport Agents (MTAs) and minimal resource usage.

0 comments