Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Self-hosting

Self-hosted mail server software: choosing a stack

Compare mailcow, Mailu, docker-mailserver, Stalwart and Windows options such as SmarterMail and Exchange SE by RAM, admin effort and what each includes.

CloudSat teamNovember 18, 20267 min read
Abstract illustration of envelopes sorted into stacked server blocks of different sizes
On this pageWhat every stack has to provide

A mail server is five or six programs that have to agree on everything: one accepts SMTP, one stores mailboxes, one scores spam, one signs outgoing mail, one serves webmail, and a panel ties them together. Choosing mail server software mostly means choosing who glues those parts together for you, and how much memory the glue costs. This guide compares the stacks worth considering on Linux and on Windows, after a short look at the work that no software choice removes.

What every stack has to provide

Job Typical software
SMTP in and out (the MTA) Postfix, Exim, or built in (Stalwart)
Mailbox access over IMAP and POP3 Dovecot
Spam and phishing scoring Rspamd, SpamAssassin
Malware scanning ClamAV
DKIM signing, SPF and DMARC checks Rspamd, OpenDKIM
Webmail Roundcube, SOGo, SnappyMail
Administration each bundle's own panel or script

The bundles below differ in which of these they pick, how they package them and what they leave to you.

The work no software choice removes

Deliverability depends on the address and the DNS, not on the brand of the MTA. Before installing anything:

  • Use a static IPv4 with reverse DNS that matches the server's hostname, such as mail.example.com.
  • Confirm that outbound port 25 is open. Many providers restrict it on new servers.
  • Check the address against public blocklists. A recycled IP with a bad history will hurt you for weeks.
  • Publish MX, SPF, DKIM and DMARC records, and add MTA-STS once TLS works.
  • Plan time for logs. Someone has to read bounces and DMARC reports every week.

On CloudSat, reverse DNS is set from the console, and the docs cover both first steps: Set reverse DNS for your IPv4 and Send email from your server.

A minimal zone for one domain looks like this; the DKIM key comes from whichever stack you install:

example.com.                       IN MX  10 mail.example.com.
mail.example.com.                  IN A   203.0.113.25
example.com.                       IN TXT "v=spf1 mx -all"
_dmarc.example.com.                IN TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"
dkim._domainkey.example.com.       IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

Linux stacks side by side

mailcow: the full suite

mailcow (GPL-3.0) runs as a set of Docker containers built around Postfix, Dovecot, Rspamd, ClamAV and SOGo, which adds webmail, calendars, contacts and ActiveSync for phones. Its web panel handles domains, mailboxes, aliases, DKIM keys and the spam quarantine, and update.sh upgrades the whole stack. It is also the hungriest option: the documented minimum is 6 GiB of RAM plus 1 GiB of swap, with 8 GiB recommended for 5 to 10 users. Setting SKIP_CLAMD=y and SKIP_FTS=y in mailcow.conf turns off ClamAV and full-text search to save memory. Supported hosts include Debian 11 to 13, Ubuntu 22.04 or newer, AlmaLinux 8 and 9 and Rocky Linux 9.

Mailu: the lighter Docker suite

Mailu (MIT) is also a set of Docker images, with SMTP, IMAP, webmail, an admin interface with per-domain delegation, Rspamd antispam with greylisting, and an optional antivirus scanner. A setup utility at setup.mailu.io generates the docker-compose.yml and mailu.env files. It fits small servers: the documentation asks for 1 GB of RAM and 1 GB of swap without ClamAV, or 3 GB plus 1 GB of swap with it.

docker-mailserver: configuration files, no panel

docker-mailserver (MIT) packs Postfix, Dovecot, Rspamd or Amavis with SpamAssassin, ClamAV, Fail2ban and OpenDKIM into a single container. There is no web interface; accounts and DKIM keys are managed with its setup command and environment variables, which suits people who keep server configuration in Git:

docker exec -it mailserver setup email add alice@example.com
docker exec -it mailserver setup config dkim

It runs on 1 vCPU and 512 MB of RAM if you leave ClamAV off, and its FAQ recommends 2 GB with swap. ClamAV alone loads a signature database of about 850 MB into memory.

Stalwart: one Rust server for mail, calendars and files

Stalwart takes a different route: instead of gluing Postfix and Dovecot, one Rust program speaks SMTP, IMAP, POP3 and JMAP, plus CalDAV, CardDAV and WebDAV. Spam and phishing filtering, DKIM, SPF, DMARC and ARC, ACME certificates, MTA-STS and DANE are built in, and it is managed from a web admin or a CLI. Storage is pluggable, from RocksDB or SQLite on one server to PostgreSQL, MySQL and S3-compatible object storage. Version 1.0, the first stable release, arrived on October 26, 2026; servers on earlier versions need a one-time migration. The community edition is AGPL-3.0, with a paid enterprise edition.

Appliance installers: Mail-in-a-Box and iRedMail

Mail-in-a-Box turns a fresh Ubuntu 22.04 LTS server into a complete mail host: Postfix, Dovecot, Roundcube, Nextcloud for contacts and calendars, SpamAssassin, greylisting, Fail2ban and backups. It also runs its own DNS server and publishes SPF, DKIM, DMARC, DNSSEC, DANE and MTA-STS records for you. The catch is the base system: Ubuntu 22.04 leaves standard support in 2027, so check the project's plans before you commit.

iRedMail is a shell installer for a fresh Linux or BSD server (Ubuntu 24.04 is its recommended target, with Debian, Rocky Linux, AlmaLinux, FreeBSD and OpenBSD supported). It sets up Postfix, Dovecot, Roundcube or SOGo and the iRedAdmin panel; a paid iRedAdmin-Pro adds more administration features.

If the server has to run Windows

Option Cost model Notes
Exchange Server SE Server licenses and CALs with active Software Assurance, or a subscription Out since July 1, 2025 under the Modern Lifecycle Policy; Exchange 2016 and 2019 reached end of support on October 14, 2025
SmarterMail Commercial, with a Free edition Free covers one domain and up to 10 mailboxes, without MAPI, EWS or ActiveSync sync; also runs on Linux
MailEnable Standard Free SMTP, IMAP, POP3 and webmail; paid editions add collaboration and clustering
hMailServer Free, open source SMTP, IMAP and POP3 without webmail (pair it with Roundcube); maintained 5.7 releases, older builds unsupported

Exchange makes sense when the organization already depends on Outlook features, Active Directory and Exchange skills. For a handful of mailboxes, the free Windows options carry far less overhead.

Match the stack to the people running it

Situation Good fit
Small team that wants webmail, calendars, phone sync and a panel mailcow on an 8 GB server
A few domains on a small server, panel wanted Mailu
Configuration in Git, no panel needed docker-mailserver
One modern daemon with JMAP and built-in DAV Stalwart
An appliance that also runs DNS Mail-in-a-Box
Windows shop that needs Outlook-native features Exchange SE, or SmarterMail
Windows, a few mailboxes, no budget MailEnable Standard or hMailServer

mailcow's 8 GiB recommendation lines up with a 4 vCPU, 8 GB Cloud VPS at $21.18/mo, while Mailu or docker-mailserver without ClamAV fit a 2 GB plan.

Test before you move real mailboxes

Send from the new server to an outside mailbox and read the raw headers: you want spf=pass, dkim=pass and dmarc=pass in the Authentication-Results line. swaks, packaged in Debian and Ubuntu, makes the test repeatable:

sudo apt install swaks
swaks --to you@other-provider.example --from test@example.com \
  --server mail.example.com:587 --tls --auth-user test@example.com

Then confirm that the server refuses to relay for strangers, and turn on spam and malware filtering before the first real user logs in; our guide to spam and malware filtering on your own mail server covers both. Copy existing mailboxes over IMAP with a tool such as imapsync, one user at a time, before you switch the MX record.

FAQ

How much RAM does a self-hosted mail server need?

It depends on the stack and on ClamAV. docker-mailserver runs in 512 MB without antivirus, Mailu wants 1 GB plus swap (3 GB with ClamAV), and mailcow asks for 6 GiB plus 1 GiB of swap. Antivirus is the largest single cost.

Can the mail server share a VPS with my websites?

It can, but a compromised website then exposes every mailbox, and a blocklisted address takes your site's outgoing mail down with it. A separate small server for mail keeps those failures apart.

Do I need IPv6 for mail?

No, but if the server has an IPv6 address the large providers check it as strictly as IPv4. Either set matching reverse DNS for it, or have the MTA send over IPv4 only (in Postfix, inet_protocols = ipv4).

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.