Configs2026年5月16日·1 分钟阅读

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.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
MailHog
通用 CLI 安装命令
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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产