Skip to content

Mail Hog

Local email testing tool that captures outgoing email for development and testing.

Self-hostedNot yet verified
Report issue
MIT★ 14000Source project only — not browser-runnable

External Tool

This open-source tool is maintained externally. View the source on GitHub to learn more or run it yourself.

Browse developer tools →

What's next with Mail Hog?

Choose how you want to get started.

Use it free

Open the official tool or demo — no account needed.

Free

Self-host it

Run the open-source version on your own infrastructure.

Open

What is Mail Hog?

MailHog is an open-source email testing tool designed for developers to debug and verify email functionality during application development. It acts as a local SMTP server that intercepts outgoing emails, allowing users to inspect messages in a web interface or access them via an API. Developers, quality assurance teams, and DevOps engineers use MailHog to simulate real-world email delivery scenarios without relying on external mail servers. The tool solves the problem of testing email workflows in isolation, ensuring messages are properly formatted, routed, and free of errors before deployment. By capturing emails locally, MailHog reduces the risk of sending test emails to real recipients and streamlines the debugging process for applications that rely on email communication.

How it works

MailHog is a lightweight SMTP server built with Go (Golang) that runs on multiple platforms without requiring installation. It serves as a development tool to capture and inspect emails sent by applications configured to use it as their SMTP relay. The primary purpose of MailHog is to provide a sandboxed environment for testing email-related features, such as HTML templates, authentication mechanisms, and delivery pipelines, without exposing test emails to external networks. MailHog offers a web-based interface to view captured emails, including headers, body content, and attachments. Developers can also retrieve messages via its JSON API for programmatic analysis or integration with testing frameworks. It supports standard SMTP protocols and can be configured to act as a temporary mail server during development cycles.

How to use it

  1. 1Download MailHog from its GitHub repository or use a package manager. 2. Run the binary to start the SMTP server locally. 3. Configure your application to use MailHog's SMTP endpoint (e.g., localhost:1025). 4. Send test emails through the application and access them via the web UI at http://localhost:8025. Practical tips: Use environment variables to switch between MailHog and production SMTP servers. Automate email retrieval via the API for integration with testing tools like Selenium or Postman.

What it can do

  • email testing

Use cases

Assumptions and limitations

Assumptions

  • source: https://github.com/mailhog/MailHog
  • license: MIT — free to use
  • privacy: Self-hosted — you control your data

Limitations

  • Lacks advanced filtering or analytics for email content
  • Does not support spam filtering or email validation rules
  • Requires manual configuration for complex SMTP relay scenarios
  • No built-in support for email encryption (e.g., TLS/SSL) testing
  • Limited real-time monitoring capabilities compared to dedicated email services

Understanding the result

Local email testing tool that captures outgoing email for development and testing.

Tool details

  • Clearly flagged when a network request is needed.
  • No account, no sign-up, and no tracking of your content.
  • Powered by (MIT).
Built with
(mailhog/MailHog)
License
MIT
Runs locally
No — requires a network request
Verification
Not yet verified
Input
Query
Output
Text
Open-source source & license

Built with mailhog/MailHog. OpenToolVault provides the discovery and browser interface while crediting the original project maintainers.

Built with
License
MIT
View source on GitHub

Open-source project

OpenToolVault is an independent directory. We are not affiliated with or endorsed by this project.

References

Frequently asked

How does MailHog differ from traditional SMTP testing tools?

MailHog simplifies SMTP testing by providing an integrated web UI and API for email inspection, whereas traditional tools often require manual log analysis or external email clients. It also runs natively on multiple platforms without installation, making it more accessible for developers. Unlike some alternatives, MailHog does not require a mail server to be running for basic testing.

How does MailHog handle email delivery to real servers?

MailHog acts as an intermediary SMTP server. Emails sent to it are stored locally for inspection but can be manually forwarded to a real mail server using its API or CLI tools. This allows developers to transition from testing to production delivery without changing application configurations.

How do I retrieve an email from MailHog's API?

Use a HTTP GET request to http://localhost:8025/api/v1/messages/{messageID} to fetch an email's raw data. For example, send a GET request with the message ID to retrieve the email body and headers. The API returns JSON data that can be parsed programmatically for automation.

How does MailHog compare to alternatives like MailCatcher?

MailHog is inspired by MailCatcher but offers improved cross-platform compatibility and a simpler installation process. Unlike MailCatcher, which relies on Ruby and has a more complex setup, MailHog uses Go and runs without dependencies. Both tools provide web UIs for email inspection, but MailHog's API is more extensible for integration with testing frameworks.

How do I resolve 'Connection refused' errors when using MailHog?

A 'Connection refused' error typically indicates MailHog is not running or the SMTP port (1025) is blocked. Verify the service is active using 'mailhog -version' or check firewall settings. If using Docker, ensure the container is properly mapped to the host's ports. Restarting the service or reconfiguring the application's SMTP settings may resolve the issue.

Spotted something wrong with Mail Hog, or want to maintain it? See how to help.