Self-hosting Mailpit the easy way

Self-hosting Mailpit the easy way

Yulei Chen - Content-Engineerin bei sliplane.ioYulei Chen
5 min

Mailpit is a free, open-source email and SMTP testing tool built for developers. It captures all outgoing emails and displays them in a clean web UI, so you can inspect HTML rendering, headers, attachments, and more. Unlike paid services like Mailtrap or Mailhog (which is no longer maintained), Mailpit is completely free with no message limits or feature gates.

Sliplane is a managed container platform that makes self-hosting painless. With one-click deployment, you can get Mailpit up and running in minutes - no server setup, no reverse proxy config, no infrastructure to maintain.

Prerequisites

Before deploying, ensure you have a Sliplane account (free trial available).

Quick start

Sliplane provides one-click deployment with presets.

SliplaneDeploy Mailpit >
  1. Click the deploy button above
  2. Select a project
  3. Select a server (If you just signed up you get a 48-hour free trial server)
  4. Click Deploy!

About the preset

The one-click deploy above uses Sliplane's Mailpit preset. Here's what it includes:

  • Image: axllent/mailpit:v1.30.0 - the official Mailpit Docker image
  • Persistent storage mounted to /data for the SQLite database
  • MP_MAX_MESSAGES set to 5000 - limits stored messages to keep things fast
  • MP_DATABASE set to /data/mailpit.db - stores emails in a persistent SQLite database
  • SMTP auth configured to accept any credentials, making it easy to point your app at Mailpit without extra setup
  • Health check on /readyz for reliable uptime monitoring

Next steps

Once Mailpit is running on Sliplane, access the web UI using the domain Sliplane provided (e.g. mailpit-xxxx.sliplane.app).

Sending emails to Mailpit

To send emails from another service running on the same Sliplane server, use Mailpit's internal hostname and SMTP port:

  • SMTP Host: mailpit-xxxx.internal (check your service's internal hostname in the Sliplane dashboard)
  • SMTP Port: 1025
  • Username/Password: Any value works (SMTP auth accepts anything by default)

For example, if you're running n8n or another automation tool on the same server, just point its SMTP settings to Mailpit's internal address.

Environment variables

You can customize Mailpit's behavior with these environment variables:

VariableDefaultDescription
MP_MAX_MESSAGES5000Maximum number of messages to store
MP_DATABASE/data/mailpit.dbPath to the SQLite database file
MP_SMTP_AUTH_ACCEPT_ANY1Accept any SMTP credentials
MP_UI_AUTH_FILE(not set)Path to an htpasswd file for UI authentication
MP_SMTP_RELAY_CONFIG(not set)Path to a SMTP relay config file for forwarding emails

Check the Mailpit configuration docs for the full list of options.

Logging

Mailpit logs to STDOUT by default, which works perfectly with Sliplane's built-in log viewer. You can adjust the log verbosity with the MP_VERBOSE environment variable. For general Docker log tips, check out our post on how to use Docker logs.

Cost comparison

You can also self-host Mailpit with other cloud providers. Here is a pricing comparison for the most common ones:

ProvidervCPURAMDiskMonthly CostNote
Sliplane22 GB40 GB€9 (~$10.65)Flat rate, 1 TB bandwidth, SSL included
Fly.io22 GB40 GB~$18Disk and bandwidth billed separately
Render12 GB40 GB~$35100 GB bandwidth, Disk billed separately
Railway22 GB40 GB~$67 + $20 planPro plan floor, usage-based, bandwidth billed separately
Click here to see how these numbers were calculated.

(Assuming an always-on instance running 730 hrs/month)

  • Sliplane: flat €9/month for the Base server. Unlimited services on the same server, 1 TB egress and SSL included.
  • Fly.io: shared-cpu-2x 2 GB = $11.83/mo + 40 GB volume × $0.15/GB = $6 -> ~$17.83/mo. Egress billed separately ($0.02/GB in EU).
  • Render: closest match is Standard ($25, 1 vCPU / 2 GB) plus 40 GB disk × $0.25/GB = $10 -> ~$35/mo. Stepping up to Pro (2 vCPU / 4 GB) costs $85/mo + disk.
  • Railway (Pro plan): CPU 2 × $0.00000772/s × 2,628,000 s = $40.57; RAM 2 × $0.00000386/s × 2,628,000 s = $20.29; volume 40 × $0.00000006/s × 2,628,000 s = $6.31 -> ~$67/mo compute, plus the $20/mo Pro plan floor and $0.05/GB egress.

Bandwidth costs can add up fast on usage-based providers. Use our bandwidth cost comparison tool to see what your egress would cost on each platform.

FAQ

What is Mailpit used for?

Mailpit is a development and testing tool that captures all outgoing emails from your application. Instead of accidentally sending test emails to real users, Mailpit intercepts them and lets you inspect the content, HTML rendering, headers, and attachments in a web UI. It also provides an API for automated testing.

How do I add authentication to the Mailpit web UI?

By default, the preset doesn't set up UI authentication. To add it, you need to create an htpasswd file and set the MP_UI_AUTH_FILE environment variable. You can generate htpasswd entries using the htpasswd command or an online generator, then mount the file via a volume.

How do I update Mailpit?

Change the image tag in your service settings on Sliplane and redeploy. Check Docker Hub for the latest stable version.

Can Mailpit relay emails to a real SMTP server?

Yes. Mailpit supports SMTP relaying, which lets you selectively forward captured emails to a real mail server. Set the MP_SMTP_RELAY_CONFIG environment variable to point to a relay configuration file. See the Mailpit relay docs for the full setup.

Is Mailpit a replacement for Mailhog?

Yes. Mailpit was created as a modern, actively maintained alternative to Mailhog, which is no longer updated. Mailpit offers better performance, a cleaner UI, message search, HTML checking, link checking, and an API - all features that Mailhog lacks or handles poorly.

Self-host Mailpit now - It's easy!

Sliplane gives you everything you need to run Mailpit without server hassle.