Analytics cookies only (Google Analytics, PostHog). No ad networks, no cross-site tracking. See our privacy policy.
Self-host Mailpit
updated Nov 2026deployed by usprices checked · Jul 2026Install verified on Ubuntu 26.04 · Nov 2026 · how we test
We earn commissions when you shop through the links below. Full disclosure →
An email and SMTP testing tool. It runs an SMTP server on port 1025 that accepts mail from your application and keeps it instead of delivering it, and a web interface on port 8025 where you read the messages: rendered HTML, plain text, headers, raw source and attachments. It has search and tagging, HTML and link checks, an optional spam check through SpamAssassin or Rspamd, a REST API for integration tests, an optional POP3 server, and an optional relay to release a message to a real SMTP server. Messages are kept in a SQLite database; by default that is a temporary file removed on exit, and a database path makes it persistent. It keeps the most recent 500 messages unless told otherwise.
Pick Mailpit when you want a catch-all inbox for development and staging mail: your application sends to its SMTP port, nothing is delivered to anyone, and you read the messages in a web interface with rendered HTML, headers, raw source, attachments, search and tags. A REST API makes it usable in integration tests, and optional HTML, link and spam checks cover mail-client compatibility. It is MIT-licensed Go with a Vue interface, a single static binary in a small image, and the README calls it a small, fast, low-memory tool. Our snippet adapts the docs' Docker Compose example, pins `axllent/mailpit:v1.33.1` (pushed to Docker Hub 2026-11-07, amd64, arm64 and 386) instead of the unpinned image, and stores the SQLite database in `./data`. The docs state no minimum RAM, so our 128 MB floor is a modest figure. It was inspired by MailHog, which the README says is no longer maintained. It is a testing tool, not a mail server for real users: it accepts mail and keeps it.
What you need
Any VPS with at least 128 MB of RAM
A domain you control — most self-hosted setups need HTTPS in front of them
Paid link — we earn a commission if you shop through it.
Install
Run these commands on your server:
# Mailpit — SMTP and email testing — adapted from the docs' Docker Compose example, pinned to v1.33.1 (the docs use the unpinned image), database persisted in ./data, SMTP and web UI open without authenticationmkdir -p datacat > docker-compose.yml <<'EOF'services: mailpit: image: axllent/mailpit:v1.33.1 restart: unless-stopped ports: - "8025:8025" - "1025:1025" volumes: - ./data:/data environment: MP_DATABASE: /data/mailpit.dbEOFdocker compose up -dtimeout 120 bash -c 'until curl -fsSL -o /dev/null http://localhost:8025/readyz; do sleep 2; done'# → http://SERVER_IP:8025 — the Mailpit inbox, empty; there is no login. Point your app's SMTP at SERVER_IP:1025 (no auth, no TLS) and mail appears here
Mailpit's README and docs flag these before you rely on it:
non-negotiableThe web interface, the API and the SMTP port are open by default. Web UI and API authentication is optional and comes from a password file set in MP_UI_AUTH_FILE, and the snippet does not set one, so anyone who can reach ports 8025 or 1025 can read every captured message or inject new ones. Keep both ports on a trusted network or put an authenticating proxy in front.
non-negotiableCaptured mail is sensitive. Applications under test often send password-reset links and real addresses; treat the database in ./data like application data, and note that without MP_DATABASE the docs say the database is a temporary file deleted on exit.
non-negotiableOnly the most recent 500 messages are kept by default (MP_MAX_MESSAGES, 0 disables pruning); MP_MAX_AGE prunes by age. A busy test suite can push older messages out sooner than you expect.
non-negotiableNothing is delivered. Releasing a message to a real mailbox needs an SMTP relay configuration file passed through MP_SMTP_RELAY_CONFIG, and the docs describe forwarding as a separate feature; the snippet configures neither.
non-negotiableBy default any Host header is accepted. Since v1.31.1 the MP_ALLOWED_HOSTS allowlist mitigates DNS-rebinding attacks against the API and websocket; set it if the interface is reachable from a browser on an untrusted network.
non-negotiableFor persistent storage on a network share (NFS or Samba) the runtime options say to set MP_DISABLE_WAL, because write-ahead logging is not compatible with network file systems. The snippet's local bind mount does not need it.