Testing email notifications from your own application has one recurring problem: if the application sends emails via a real SMTP, sooner or later a typo in the test data or a forgotten environment change will cause a test password reset or an invoice to be sent to a real customer's inbox. Mailtrap solves this in the cloud, but with a subscription that increases with the number of emails sent. Mailpit is an open-source SMTP catcher that you set up on your own Box, it intercepts every message sent via SMTP from your application and displays it in a web panel, with no limit on the number of emails and no monthly fee. Below is a step-by-step guide on how to set up Mailpit on Saplo.
Why Mailpit instead of sending to a real inbox or Mailtrap
Testing emails without a dedicated catcher usually goes one of two ways, both with disadvantages:
- sending to a real test inbox - works until someone mistakes an environment variable or recipient address in the test data, and then the test email goes where it shouldn't.
- Mailtrap and similar cloud services - solve this problem, but they cost money, and the limit on the number of captured emails in the free plan runs out faster than your team finishes testing.
Mailpit runs as a single Docker container on your Box, so every email sent via SMTP from the application is captured locally, with no message limit and no risk of anything going to a real recipient.
Mailpit vs. Mailtrap and MailHog
Mailpit is the direct successor to MailHog, a project that hasn't been developed for a long time. So the natural question is, what's the difference between them?
- Mailtrap is a cloud service with a free limit on the number of emails intercepted per month. It's convenient because you don't have to set anything up, but it's paid for higher test traffic and your data is with an external provider.
- MailHog is an older project with a very similar role, but without active development for years, so it no longer receives fixes or new features.
- Mailpit combines the advantages of both. It's actively developed, like MailHog once was, and you host it on your own Box like Mailtrap, with no email limit and no charge for test traffic.
If your team tests a lot of email notifications and wants to have full control, without a limit in the free plan and without waiting for a dead project, Mailpit fits best.
Requirements
To set up Mailpit on Saplo, you need:
- A Box with Docker running (the engine automatically enables it when installing from the catalog, container nesting is required, which Saplo has by default),
- A minimum of 256 MB RAM free on the Box and 2 GB of disk space, meaning a Box S plan is sufficient,
- A Domain or subdomain
*.saploapp.plincluded with every plan, where the mail preview panel will be located, - You DO NOT create a separate database - Mailpit stores intercepted emails in its own SQLite file within the data volume.
Step-by-step installation
- In the Saplo panel, go to App catalog and select Mailpit (in the "Tools" category).
- Select a Box with at least 256 MB of free RAM, on which the catcher will be installed, and the Domain or subdomain under which the panel will operate.
- Confirm the installation. The engine deploys a container from the official
axllent/mailpitimage, generates a random SMTP port, and exposes the web panel exclusively on the Box's loopback, connected to Nginx, which serves it under the specified Domain with free SSL. Only the panel is exposed externally; the SMTP port remains available only locally on the Box. - After
docker compose up, the engine checks if the panel is actually responding via HTTP before considering the installation complete. - SMTP connection details for other applications on the same Box (host, port) are saved to the
MAILPIT-SETUP.txtfile in the application directory.
First-time setup
Mailpit, unlike Chatwoot or Directus, doesn't have an Account or login panel. It's a sandbox for testing, not a real mail server, so the panel is open immediately after installation.
- Go to your Domain address, for example
poczta-test.saploapp.pl, and you'll see an empty list of intercepted emails, ready for your first message. - In the SMTP configuration of your application (WordPress, Django, Node) on the same Box, enter the host
127.0.0.1and the port specified in theMAILPIT-SETUP.txtfile. The username and password can be anything, Mailpit accepts any login credentials. - Send a test email from your application, for example, a password reset or an order notification, and refresh the Mailpit panel. The message will appear on the list with an HTML and text content preview, as well as attachments.
- You can open each intercepted email, check SMTP headers, and preview how it looks in an email client, without the risk of anything reaching a real recipient.
- No email intercepted by Mailpit is sent anywhere further. It's solely a local preview for testing purposes.
Mailpit on Saplo vs. Mailtrap and MailHog
| Mailtrap Cloud | MailHog | Mailpit on Saplo | |
|---|---|---|---|
| Email limit | yes, in free plan | none | none |
| Active development | yes | no | yes |
| Where captured email content is stored | on provider's server | on your server | on your Box |
| Cost | subscription after exceeding limit | cost of your own server | cost of the Box itself |
Frequently asked questions
Does Mailpit forward emails to real recipients? No, every email sent via SMTP to Mailpit is only intercepted and displayed in the panel; it never reaches a real recipient.
Do I need to provide real SMTP login credentials in the application? No, Mailpit accepts any username and password, as it only intercepts test mailings, it's not a real mail server.
How is Mailpit different from MailHog, since they do the same thing? Mailpit is an actively developed successor to MailHog, a project that has not received updates for a long time.
Is Mailpit suitable for production use? No, it's solely a sandbox for testing, for real mailings you need a separate mailbox or transactional service.
If your team tests email notifications from your application and wants to be sure that no test email goes to a real customer, write to us, we will help you choose the right Box for your team.
- #DevOps
- #Mailpit
- #Guide
- #SMTP
- #Testing
