Deployment guide

Mailpit: Self-Hosted SMTP Testing Server on Your VPS

Deploy on a VPS Cloud →

Self-hosting5 min read

Mailpit: Self-Hosted SMTP Testing Server on Your VPS

Mailpit is the unofficial successor to MailHog: an SMTP test server that captures every email sent by your application and displays it in a modern web interface, without ever delivering it to a real recipient. With full-text search, spam scoring, HTML compatibility checks, and a REST API for your CI pipelines, Mailpit has become the standard tool for teams testing their email-sending code. This guide shows you how to deploy it in under two minutes on your VPS.

Why replace MailHog with Mailpit

MailHog was the go-to SMTP test server five years ago. But it has been unmaintained since 2020 and carries an unpatched stored XSS vulnerability (Exploit-DB 50971): any email containing JavaScript can compromise the web interface. Mailpit replaces it with a modern Go binary (under 50 MB RAM), a clean interface, full-text search, a documented REST API, an HTML compatibility report, and built-in spam scoring. It ships as the default in Laravel Sail since version 11 and in DDEV since version 1.22, making it the new industry standard.

What Mailpit brings in practice

  • SMTP capture on port 1025 — no email ever leaves your VPS, just configure your app to use localhost:1025.
  • Web interface on port 8025 with full-text search across subject, sender, and body.
  • REST API GET /api/v1/messages — query emails from your integration tests without any external relay.
  • Spam scoring with SpamAssassin rules — catch deliverability issues before production.
  • HTML compatibility report — spot CSS properties that will be stripped by Gmail, Outlook, or Apple Mail.
  • Mobile preview and raw source view, with full HTML rendering and detailed headers.
  • POP3 interface to fetch captured emails with any mail client.
  • SQLite on a persistent volume — messages survive container restarts.

Deployment architecture on a VPS

Mailpit runs in a single Docker container. The SMTP server is accessible on localhost:1025 (loopback only), meaning only applications running on the same VPS can send emails to it — exactly what you want. The web interface is exposed on localhost:8025 and then proxied by nginx to a domain of your choice. This pattern is identical to Node-RED, Plausible, or Umami: one container, one loopback port, one nginx domain, one persistent volume.

Deploy Mailpit in 5 steps

01

Deploy from the ServOrbit marketplace

Open your control panel, go to Marketplace → Development → Mailpit and click Deploy. The container starts in under ten seconds.

02

Configure your application SMTP

In your environment variables, set MAIL_HOST=127.0.0.1 and MAIL_PORT=1025. No authentication, no TLS required by default. Laravel, Symfony, Django, Node.js — all support this configuration natively.

03

Open the web interface

Navigate to the domain attached to your Mailpit instance. You will see the real-time inbox: click any email to inspect its HTML rendering, headers, and spam score.

04

Integrate the REST API into your tests

Call GET https://mailpit.your-domain.com/api/v1/messages from your test suite. Filter by recipient, verify the subject, count attachments — all without mocks or stubs.

05

Check HTML compatibility

Open any HTML email and click the Compatibility tab. Mailpit lists unsupported CSS properties client by client, with links to recommended fixes.

Mailpit in CI/CD: testing emails in the pipeline

Deploy Mailpit as a service in your test docker-compose.yml (image: axllent/mailpit:latest, ports: 127.0.0.1:8025:8025 and 127.0.0.1:1025:1025). Your integration tests send emails to localhost:1025, then verify via the REST API that the correct message was received. This pattern is used by Laravel, Symfony, and Django teams to validate notifications and transactional emails without an external relay.

Mailpit vs MailHog vs Mailtrap

MaintainerAxle Springer (active)Abandoned since 2020Mailtrap Inc. (SaaS)
SecurityNo known vulnerabilitiesUnpatched stored XSSSaaS — data hosted elsewhere
REST APIComplete and documentedBasic, undocumentedYes (paid plan)
Spam scoringBuilt-in (SpamAssassin)NoneYes (paid plan)
HTML compatibilityBuilt-in reportNoneYes (paid plan)
PriceFree, MITFree, MITFreemium, then $24/month
Self-hostingOne Docker containerOne Go binarySaaS only

Advanced use cases

Beyond simple send testing, Mailpit offers several lesser-known features. Multi-tenant mode (--mp-tenant) separates emails by application in a single server. SMTP authentication (MP_SMTP_AUTH_FILE) restricts who can connect. The MP_UI_AUTH_FILE variable adds basic auth to the web interface if you expose it publicly. And configurable retention (MP_MAX_MESSAGES=0 for unlimited, or a specific number) lets you adjust the retention policy to your testing needs.

Deploy Mailpit in one click on ServOrbit

With a ServOrbit Cloud VPS, Mailpit is available directly from the marketplace. Set up your SMTP test environment in two minutes, with no separate server to manage.

Need help?

Browse our help center and FAQ, or reach our team — callback, WhatsApp or email. Support in French, English and Arabic.