2022-08-18 11:41:37 +02:00
# Mailpit - email testing for developers
2022-07-29 13:23:08 +02:00
2022-08-07 00:57:45 +02:00
![Tests ](https://github.com/axllent/mailpit/actions/workflows/tests.yml/badge.svg )
![Build status ](https://github.com/axllent/mailpit/actions/workflows/release-build.yml/badge.svg )
![Docker builds ](https://github.com/axllent/mailpit/actions/workflows/build-docker.yml/badge.svg )
![CodeQL ](https://github.com/axllent/mailpit/actions/workflows/codeql-analysis.yml/badge.svg )
2022-08-07 12:38:23 +02:00
[![Go Report Card ](https://goreportcard.com/badge/github.com/axllent/mailpit )](https://goreportcard.com/report/github.com/axllent/mailpit)
2022-08-07 00:57:45 +02:00
2023-08-16 06:59:37 +02:00
Mailpit is a small, fast, low memory, zero-dependency, multi-platform email testing tool & API for developers.
2022-07-29 13:23:08 +02:00
2023-08-16 06:59:37 +02:00
It acts as an SMTP server, provides a modern web interface to view & test captured emails, and contains an API for automated integration testing.
2022-07-29 13:23:08 +02:00
2023-08-16 06:59:37 +02:00
Mailpit was originally **inspired** by MailHog which is now [no longer maintained ](https://github.com/mailhog/MailHog/issues/442#issuecomment-1493415258 ) and hasn't seen active development for a few years now.
2022-07-29 13:23:08 +02:00
2022-10-07 13:26:46 +02:00
![Mailpit ](https://raw.githubusercontent.com/axllent/mailpit/develop/docs/screenshot.png )
2022-07-29 13:23:08 +02:00
2022-08-05 14:09:20 +02:00
2022-07-29 13:23:08 +02:00
## Features
2022-08-18 11:41:37 +02:00
- Runs entirely from a single binary, no installation required
2022-07-29 14:17:56 +02:00
- SMTP server (default `0.0.0.0:1025` )
2023-04-01 06:02:49 +02:00
- Web UI to view emails (formatted HTML, highlighted HTML source, text, headers, raw source and MIME attachments including image thumbnails)
2023-07-30 07:04:06 +02:00
- HTML check to test & score mail client compatibility with HTML emails
2023-08-16 06:59:37 +02:00
- Link check to test message links (HTML & text) & linked images
2023-09-06 06:20:29 +02:00
- Screenshots of HTML messages via web UI
2023-04-03 08:53:11 +02:00
- Mobile and tablet HTML preview toggle in desktop mode
2023-09-06 06:20:29 +02:00
- Light & dark web UI theme with auto-detect
2022-09-16 13:15:40 +02:00
- Advanced mail search ([see wiki](https://github.com/axllent/mailpit/wiki/Mail-search))
2022-11-13 06:20:54 +02:00
- Message tagging ([see wiki](https://github.com/axllent/mailpit/wiki/Tagging))
2022-07-30 09:57:44 +02:00
- Real-time web UI updates using web sockets for new mail
2023-08-03 07:34:00 +02:00
- Optional browser notifications for new mail (when accessed via either HTTPS or `localhost` only)
2022-07-29 13:23:08 +02:00
- Configurable automatic email pruning (default keeps the most recent 500 emails)
2022-08-30 12:42:43 +02:00
- Email storage either in a temporary or persistent database ([see wiki](https://github.com/axllent/mailpit/wiki/Email-storage))
2023-04-21 04:19:32 +02:00
- Fast SMTP processing & storing - approximately 70-100 emails per second depending on CPU, network speed & email size, easily handling tens of thousands of emails
2023-05-05 07:07:28 +02:00
- SMTP relaying / message release - relay messages via a different SMTP server including an optional allowlist of accepted recipients ([see wiki](https://github.com/axllent/mailpit/wiki/SMTP-relay))
2023-03-12 04:06:26 +02:00
- Optional SMTP with STARTTLS & SMTP authentication, including an "accept anything" mode ([see wiki](https://github.com/axllent/mailpit/wiki/SMTP-with-STARTTLS-and-authentication))
2022-08-06 10:00:05 +02:00
- Optional HTTPS for web UI ([see wiki](https://github.com/axllent/mailpit/wiki/HTTPS))
- Optional basic authentication for web UI ([see wiki](https://github.com/axllent/mailpit/wiki/Basic-authentication))
2022-11-01 09:24:28 +02:00
- A simple REST API ([see docs](docs/apiv1/README.md))
2022-08-06 10:00:05 +02:00
- Multi-architecture [Docker images ](https://github.com/axllent/mailpit/wiki/Docker-images )
2022-07-29 13:23:08 +02:00
## Installation
2023-02-06 04:27:08 +02:00
The Mailpit web UI listens by default on `http://0.0.0.0:8025` , and the SMTP port on `0.0.0.0:1025` .
2023-02-06 04:24:36 +02:00
Mailpit runs as a single binary and can be installed in different ways:
2023-04-01 06:02:49 +02:00
2023-02-06 04:24:36 +02:00
### Install via Brew (Mac)
2023-07-17 11:12:19 +02:00
Install Mailpit with `brew install mailpit` .
2023-02-06 04:24:36 +02:00
2023-04-01 06:02:49 +02:00
2023-02-06 04:24:36 +02:00
### Install via bash script (Linux & Mac)
2022-09-14 02:11:52 +02:00
Linux & Mac users can install it directly to `/usr/local/bin/mailpit` with:
```bash
sudo bash < < (curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)
```
2023-04-01 06:02:49 +02:00
2023-02-06 04:24:36 +02:00
### Download static binary (Windows, Linux and Mac)
2022-07-29 13:23:08 +02:00
2023-02-06 04:24:36 +02:00
Static binaries can always be found on the [releases ](https://github.com/axllent/mailpit/releases/latest ). The `mailpit` binary can extracted and copied to your `$PATH` , or simply run as `./mailpit` .
2023-04-01 06:02:49 +02:00
2023-02-06 04:24:36 +02:00
### Docker
2023-06-30 14:16:02 +02:00
See [Docker instructions ](https://github.com/axllent/mailpit/wiki/Docker-images ) for 386, amd64 & arm64 images.
2022-07-29 13:23:08 +02:00
2023-04-01 06:02:49 +02:00
2023-02-06 04:24:36 +02:00
### Compile from source
To build Mailpit from source see [building from source ](https://github.com/axllent/mailpit/wiki/Building-from-source ).
2022-09-14 07:25:56 +02:00
2022-07-29 13:23:08 +02:00
2023-08-04 04:47:44 +02:00
## Usage
Run `mailpit -h` to see options. More information can be seen in [the docs ](https://github.com/axllent/mailpit/wiki/Runtime-options ).
2023-05-04 12:13:06 +02:00
### Testing Mailpit
2022-07-29 13:23:08 +02:00
2023-05-04 12:13:06 +02:00
Please refer to [the documentation ](https://github.com/axllent/mailpit/wiki/Testing-Mailpit ) of how to easily test email delivery to Mailpit.
2022-07-29 13:23:08 +02:00
2023-05-04 12:13:06 +02:00
### Configuring sendmail
2022-07-29 13:23:08 +02:00
2023-05-04 12:13:06 +02:00
Mailpit's SMTP server (by default on port 1025), so you will likely need to configure your sending application to deliver mail via that port. A common MTA (Mail Transfer Agent) that delivers system emails to a SMTP server is `sendmail` , used by many applications including PHP. Mailpit can also act as substitute for sendmail. For instructions of how to set this up, please refer to the [sendmail documentation ](https://github.com/axllent/mailpit/wiki/Configuring-sendmail ).