mailpit
An email and SMTP testing tool with API for developers
A developer email testing tool that captures every outgoing email from your app during development and shows them in a browser interface, no emails reach real recipients, and it runs as a single binary with no dependencies.
Mailpit is a tool for developers who need to test email sending during development without actually delivering emails to real recipients. You run it locally or on a server, point your application's email settings at it, and it captures every outgoing email instead of forwarding them. You can then inspect those captured emails through a web interface in your browser.
The web interface shows each captured email in full, including the formatted HTML version, the plain text version, raw headers, attachments, and image thumbnails. It updates in real time as new emails arrive. Beyond just viewing emails, Mailpit includes tools to check whether your HTML email will display correctly across different email clients, verify that all links in the email work, and optionally score the email against spam filters if you have SpamAssassin running nearby.
Mailpit runs as a single binary file with no external dependencies, which means installing it is straightforward. It is available through package managers on Mac (Homebrew), Arch Linux, and FreeBSD, or you can download a static binary for Windows, Linux, or Mac directly from the releases page. Docker images are also available.
Beyond capturing and viewing emails, Mailpit can optionally relay specific messages out through a real SMTP server, which is useful when you want most emails trapped locally but occasionally need to actually deliver one. It also supports a POP3 server mode so you can pull captured messages directly into a standard email client, and it exposes a REST API for automated testing pipelines.
The project was built as a maintained successor to MailHog, which served a similar purpose but has not received updates or security fixes for several years. Mailpit is written in Go and is licensed under the MIT license.
Where it fits
- Catch all emails your app sends during development and inspect their HTML, headers, and attachments in a browser
- Check whether your HTML email renders correctly across email clients using Mailpit's built-in compatibility checker
- Run automated email assertions in CI pipelines using Mailpit's REST API
- Occasionally relay a specific captured email out through a real SMTP server while keeping the rest trapped locally