Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 16, 2026·3 min de lecture

MailHog — Email Testing Tool for Developers

MailHog is a local SMTP server and web UI that captures outgoing emails during development, letting you inspect messages without sending them to real recipients.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
MailHog
Commande CLI universelle
npx tokrepo install 36e69e63-5166-11f1-9bc6-00163e2b0d79

Introduction

MailHog is an email testing tool for developers that runs a local SMTP server and provides a web interface to view captured messages. Instead of configuring a real mail server or polluting inboxes during development, MailHog intercepts all outgoing emails so you can inspect content, headers, HTML rendering, and attachments in your browser.

What MailHog Does

  • Runs a local SMTP server that accepts mail on a configurable port
  • Stores captured messages in memory or on disk for inspection
  • Provides a web UI to browse, search, and view emails with HTML preview
  • Exposes a REST API for automated testing and CI integration
  • Supports Jim (Chaos Monkey for SMTP) to simulate delivery failures

Architecture Overview

MailHog consists of three components: an SMTP server (MailHog-Server) that accepts incoming mail, a storage backend (in-memory, MongoDB, or Maildir), and a web UI plus API (MailHog-UI) served over HTTP. Messages flow from SMTP intake to storage, and the UI polls or streams updates via WebSocket. The modular design allows swapping storage backends without changing the SMTP layer.

Self-Hosting & Configuration

  • Run as a single binary with no dependencies (download from GitHub releases)
  • Deploy via Docker with port mapping for SMTP (1025) and web (8025)
  • Configure storage backend with -storage=mongodb or -storage=maildir
  • Set authentication on the web UI with -auth-file for shared environments
  • Use environment variables MH_SMTP_BIND_ADDR and MH_UI_BIND_ADDR for custom ports

Key Features

  • Zero-config startup — single binary, no dependencies
  • HTML email preview with source view and plain-text fallback
  • REST API for querying messages in automated test suites
  • Jim chaos mode simulates network failures and slow connections
  • Supports SMTP AUTH and TLS for testing auth-enabled configurations

Comparison with Similar Tools

  • Mailpit — Mailpit is a modern actively-maintained alternative with similar features and lower resource usage
  • Mailtrap — Mailtrap is a cloud SaaS service; MailHog runs entirely locally with no account needed
  • Papercut SMTP — Papercut is Windows-only; MailHog is cross-platform (Linux, macOS, Windows)
  • LetterOpener (Ruby) — LetterOpener saves emails as files; MailHog provides a browsable web interface
  • smtp4dev — smtp4dev is .NET-based; MailHog is a single Go binary with no runtime dependencies

FAQ

Q: Does MailHog actually send emails to recipients? A: No. MailHog captures and stores all messages locally. Nothing leaves your machine unless you explicitly configure release/forwarding.

Q: Can I use MailHog in CI pipelines? A: Yes. Start MailHog in Docker, point your test suite's SMTP config at it, and use the REST API to assert on captured messages.

Q: How do I persist emails across restarts? A: Use -storage=maildir -maildir-path=/data to write messages to disk, or -storage=mongodb for a MongoDB backend.

Q: Is MailHog still maintained? A: MailHog receives limited updates. For active development, consider Mailpit which is a compatible successor with ongoing maintenance.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires