👍 What we like
- Three maintained open-source projects, from the most complete (mailcow) to the simplest (Mail-in-a-Box)
- Full control over domains, aliases, quotas and backups
- DKIM signing generated by all three
👎 What to watch
- A non-listed IP, reverse DNS (PTR) and outbound port 25 are mandatory, often on request from the host
- Ongoing monitoring of IP reputation and blocklists
- mailcow needs a roomy VPS; Mail-in-a-Box requires a machine of its own
📑 Contents ▾
- 01 Comparison table
- 02 mailcow: the complete suite, at the cost of resources
- 03 Mailu: the mail server that fits into a homelab
- 04 Mail-in-a-Box: install everything with one command, on a dedicated machine
- 05 Which one for your situation
- 06 Leaving Gmail without running a server: Infomaniak, Proton Mail or Mailo
- 07 Getting your Gmail messages over without losing anything
- 08 The real prerequisite of self-hosted email: deliverability
- 09 Backup
- 10 FAQ
- 11 Hosting your mail server
To self-host your mail, pick mailcow if you manage several domains and have a VPS with 6 GB of RAM, Mailu if you already run a homelab with a reverse proxy, and Mail-in-a-Box if this is your first mail server and you can give it a whole machine. All three fail the same way without a clean IP, reverse DNS and outbound port 25: deliverability depends more on the host than on the software. If your goal is only to leave Gmail without losing your emails, a European mail host (Infomaniak, Proton Mail, Mailo) spares you all that maintenance; that is covered further down.
This comparison is based on the three projects’ documentation, not on an installation done for this page: the memory figures quoted are orders of magnitude to confirm in the documentation of the version you install.
Comparison table
| Criteria | mailcow | Mailu | Mail-in-a-Box |
|---|---|---|---|
| Architecture | Docker Compose (about a dozen containers) | Docker Compose (modular) | Bash script on a dedicated server |
| Required OS | Any distro with Docker | Any distro with Docker | Ubuntu 22.04 only |
| Indicative RAM | 6 GB | 2 to 3 GB | 2 GB (1 GB for very light use) |
| Webmail | SOGo (+ calendar, contacts) | Roundcube or Snappymail | Roundcube |
| Anti-spam | Rspamd | Rspamd | SpamAssassin |
| Admin interface | Web, very complete | Web, plain | Web, minimal |
| DNS | Configuration help | Configuration help | Built-in DNS server, records generated |
| CalDAV / CardDAV | Yes (SOGo) | Not built in | Yes (lightweight Nextcloud) |
| Living alongside other services | Tricky (takes ports 80/443) | Designed for it (behind your reverse proxy) | No (it owns the machine) |
| Updates | Dedicated script | docker compose pull | mailinabox upgrade |
| License | GPLv3 | MIT | CC0 |
mailcow: the complete suite, at the cost of resources
mailcow (“mailcow: dockerized”) bundles Postfix for SMTP, Dovecot for IMAP, Rspamd for anti-spam, SOGo for webmail and calendar/contact sync, ClamAV for antivirus, all driven by a particularly polished web admin interface.
Its strength is completeness: multiple domains, aliases, per-user quotas, greylisting, per-domain DKIM keys, per-user allow and block lists, ActiveSync for phones, and an Rspamd interface that lets you fine-tune spam scoring. For a small business or someone running several domains, it is the most complete of the three.
The downside is footprint. The documentation asks for 6 GB of RAM for the default configuration, and both SOGo and ClamAV slow down noticeably when memory runs short; disabling ClamAV frees a lot of memory if you can live without antivirus. A dozen containers make debugging slower, and disk usage grows quickly. Finally, mailcow wants to handle ports 80 and 443 itself: behind an existing reverse proxy, you need to follow the dedicated procedure in its documentation.
Mailu: the mail server that fits into a homelab
Mailu also runs on Docker Compose, but you pick the building blocks: internal nginx proxy, admin, IMAP (Dovecot), SMTP (Postfix), anti-spam (Rspamd), and optionally webmail (Roundcube or Snappymail), WebDAV and antivirus. A web wizard generates the mailu.env file and the Compose file, which makes the first install easy to follow.
Its main benefit is coexistence: Mailu can run behind your reverse proxy (Traefik, Caddy or nginx) without grabbing ports 80 and 443. If you already host a dozen services, it is the least disruptive. If you do not have a reverse proxy yet, our tutorial reverse proxy Caddy with Docker gives you an automatic HTTPS base to expose the webmail.
In return, the admin interface is plainer than mailcow’s, and several mailcow features (ActiveSync, Rspamd tuning from the UI, built-in backup) are missing or need manual work. Mailu does not include synced calendars or contacts: for that you need to add Radicale or Nextcloud alongside it.
Mail-in-a-Box: install everything with one command, on a dedicated machine
Mail-in-a-Box (MiaB) is not a Docker stack but a script that turns a fresh Ubuntu server into a complete mail server: Postfix, Dovecot, SpamAssassin, Roundcube, an authoritative DNS server (nsd), a lightweight Nextcloud for CalDAV and CardDAV, and automatically managed Let’s Encrypt certificates.
Its strength is DNS. MiaB can serve your zone itself and generates every record (MX, SPF, DKIM, DMARC, DNSSEC); if you keep DNS at your registrar, the interface tells you exactly what to paste there. For someone who wants a mail server that delivers without learning Postfix in depth, it is the shortest path.
The constraints are strict: MiaB wants a server to itself, running Ubuntu 22.04 according to its documentation (check the required version before installing, it changes with the project’s major releases), with no other service installed. It takes over the machine and does not share a reverse proxy. SpamAssassin filters less finely than Rspamd, and customization is limited by design: MiaB favours convention over configuration.
Which one for your situation
Several domains for a small business. mailcow: multi-domain management, quotas, ActiveSync for the team’s phones and tunable Rspamd. Plan for a VPS with at least 6 GB of RAM.
A busy homelab with a reverse proxy. Mailu: it fits in without breaking what you have, uses little memory, and you keep control of each component.
A first mail server that has to work quickly. Mail-in-a-Box, on a VPS that does nothing else. You get a complete server, DNS included, in exchange for a machine you cannot reshape as you like.
One or two personal accounts. Ask yourself whether self-hosting is worth the effort: a VPS with a clean IP reputation, maintenance, and the risk of blocklisting if you make a mistake. If you are set on it, MiaB or a minimal Mailu are the least demanding. Otherwise, the next section is for you.
Leaving Gmail without running a server: Infomaniak, Proton Mail or Mailo
Many people who want to leave Gmail are looking for a privacy-friendly service, not a server to administer. A European mail host handles deliverability for you and usually lets you use your own domain name.
| Service | Origin | Custom domain | What sets it apart |
|---|---|---|---|
| Infomaniak Service Mail | Switzerland | Yes, with 5 addresses | Simple offer, close to using Gmail with your own domain |
| Proton Mail Plus | Switzerland | Yes, on paid plans | End-to-end encrypted mail |
| Mailo (paid plans) | France | Yes, on paid plans | No ads and no data exploitation |
Infomaniak Service Mail suits a hassle-free move: the offer includes 5 addresses on your domain, a webmail and mobile apps. It is the most straightforward choice for a family or a freelancer who wants to keep their habits. The service is described on Infomaniak’s page.
Proton Mail puts privacy first, with end-to-end encryption. That encryption only fully applies between correspondents who also use it: a message received from Gmail or Outlook was readable by those services upstream. A custom domain requires a paid plan.
Mailo is a French service that highlights its lack of advertising and of data exploitation. As with Proton, using your own domain requires a paid plan.
A mail host is not self-hosting: your emails stay with a third party, just a more respectful one. If you also want to replace Google’s calendar, storage and office suite, see our comparison of self-hosted alternatives to Google Workspace.
Getting your Gmail messages over without losing anything
Whether you move to mailcow, Mailu, MiaB or a mail host, the transfer goes through IMAP:
- imapsync copies a whole mailbox from one server to another, folders and messages included; mailcow has an IMAP sync assistant in its interface to run these copies in batches.
- Mail hosts usually provide their own import tool: check their help page for the method they offer for Gmail before subscribing.
- Back up before migrating: a local copy of the Gmail mailbox protects you from an interrupted import.
- Check the quota of the new service, especially on a free plan: a Gmail mailbox several years old can exceed it.
- Reconfigure your clients (Thunderbird, Outlook, phone) once the copy is done, so you do not keep sending from the old account.
The real prerequisite of self-hosted email: deliverability
Whatever the software, a perfect server on a blocklisted IP will send nothing. All three need the same conditions:
- Reverse DNS (PTR) matching your sending domain. Without it, Gmail and Outlook reject your messages.
- SPF, DKIM and DMARC published correctly. All three programs generate the DKIM key; publishing the records is up to you.
- An IP that is not on blocklists. Check it with a tool like MXToolbox before choosing your VPS: some budget hosts’ ranges are burned.
- Outbound port 25 open. Many hosts and most home routers block it by default; some unblock it on request after an anti-abuse check.
The choice of host therefore often matters more than the choice of software. Providers such as Hetzner or OVHcloud let you set the reverse DNS on their VPS. Even with a clean IP, expect to ramp up sending gradually (“warming up” the IP) during the first weeks. To prepare the server itself, follow our guide install and secure an Ubuntu VPS.
Backup
mailcow ships a backup and restore script (backup_and_restore.sh) covering the database, mail and configuration. Mailu is backed up through its Docker volumes (the mailu/ directories and the database). MiaB has built-in encrypted backup (duplicity) to a local disk or S3 storage.
Losing a mail server without a backup means losing years of mail: keep an encrypted copy off the server, as described in our guide automatic backup with Restic and Backblaze.
FAQ
Is self-hosting email realistic in 2026?
Yes, but it is not a service you install and forget. All three programs are mature; it is IP reputation and blocklist monitoring that need ongoing attention. For critical use, many people prefer a European mail host.
Why do my emails land in spam when the configuration looks right?
Most of the time it is IP reputation or a missing DNS record. Check the PTR, SPF, DKIM signature and DMARC policy, then send a test to mail-tester.com, which points out exactly what is wrong. A new IP also needs to be warmed up with gradual sending.
Can I run mailcow on the same VPS as my other services?
It is possible but tricky, since mailcow handles ports 80 and 443 by default and has to be adapted to sit behind an existing reverse proxy. If your server already hosts many services, Mailu is designed for that coexistence.
Port 25 is blocked by my host, what can I do?
Without outbound port 25, your server cannot deliver mail directly. Ask the host to unblock it, which is often granted via a ticket. Otherwise, route your outgoing mail through an authenticated SMTP relay (smarthost), at the cost of some independence.
Is a host like Infomaniak or Proton still self-hosting?
No: your messages stay with a provider. It is a reasonable compromise if you want to leave Gmail for privacy without taking on deliverability and server maintenance.
Hosting your mail server
mailcow, Mailu or Mail-in-a-Box need a VPS with a dedicated IP: check with the host that reverse DNS can be set and that outbound port 25 is open, or can be opened on request, before ordering. See PlanetHoster VPS plans