Applies to: Debian 13 and AlmaLinux 9 package versions (checked in Docker); Postfix 3.10.13 and Dovecot 2.4.1 installed and tested on Debian 13
A Linux mail server is not one program but a small set of them. You need a mail transfer agent (MTA) that sends and receives mail over SMTP, usually Postfix or Exim; an IMAP/POP3 server so people can read their mail, usually Dovecot; and spam filtering and DKIM signing on top. You can put these together yourself or install an all-in-one suite that does it for you.
The parts and the usual choices
Versions are the ones in the Debian 13 and AlmaLinux 9 repositories in our check.
- Postfix (MTA): 3.10.13 on Debian 13, 3.5.25 on AlmaLinux 9. Virtualmin uses Postfix, and so do the Ucartz guides for sending mail from your own server.
- Exim (MTA): 4.98.2 on Debian 13, 4.99.5 from EPEL on AlmaLinux 9 (it isn’t in the AlmaLinux base repositories). cPanel servers use Exim; WHM has an Exim Configuration Manager.
- Sendmail and OpenSMTPD (MTAs): also packaged in Debian 13 (Sendmail 8.18.1, OpenSMTPD 7.6.0p1) and can replace Postfix or Exim.
- Dovecot (IMAP and POP3): 2.4.1 on Debian 13, 2.3.16 on AlmaLinux 9. Mind the version: according to the Dovecot documentation, 2.3 settings will not work in 2.4 without changes. The Debian 13
dovecot.confstarts withdovecot_config_version = 2.4.0, so guides written for 2.3 need adapting. - Rspamd 3.12.1 or SpamAssassin 4.0.1 (spam filtering). Rspamd can also sign outgoing mail with DKIM.
- OpenDKIM 2.11.0 beta 2 (DKIM signing for Postfix or Sendmail).
- Roundcube 1.6.18 (webmail in the browser).
A quick look after installing on Debian 13:
$ postconf mail_version mail_version = 3.10.13 $ dovecot --version 2.4.1-4 (7d8c0e5759)
All-in-one mail server suites
- mailcow: dockerized: runs as a set of Docker containers; its compose file includes Postfix, Dovecot, Rspamd, ClamAV, SOGo (webmail and groupware), MySQL and Nginx. A good fit if you are comfortable with Docker.
- Mail-in-a-Box: according to its README it turns a fresh Ubuntu 22.04 LTS 64-bit machine into a mail server with Postfix, Dovecot, Roundcube, Nextcloud for contacts and calendars, SpamAssassin, and its own DNS server that sets SPF, DKIM and DMARC records. Install it only on a fresh server that does nothing else.
- iRedMail: an installer script. Its README lists Debian 12 and 13, Ubuntu 22.04, 24.04 (recommended) and 26.04, AlmaLinux and Rocky Linux 9 and 10, CentOS Stream 9 and 10, FreeBSD 14 and OpenBSD 7.8.
- Stalwart: one program written in Rust that handles SMTP, IMAP, JMAP, POP3, CalDAV, CardDAV and WebDAV. Dual-licensed under AGPL-3.0 and a commercial licence.
We didn’t install the suites; the details above come from their official repositories.
Which one should you use?
- Only sending from your apps (password resets, notifications): Postfix on its own is enough. See install and configure Postfix for sending.
- Mailboxes for a few domains with little upkeep: a suite such as mailcow or Mail-in-a-Box on a server of its own.
- Websites and mail on one server: a control panel. cPanel (Exim) and Virtualmin (Postfix) set up mail, DNS and webmail for each domain.
- Full control: Postfix, Dovecot and Rspamd put together by hand. Most flexible, and most work.
Before you install anything
- Outgoing port 25 must be open, or your server can’t deliver mail to other mail servers. All Ucartz servers have port 25 open; you can check that outgoing port 25 works.
- A proper host name and reverse DNS: the server name (for example
mail.example.com) should resolve to the IP, and the IP’s PTR record back to the name. See set reverse DNS. - SPF, DKIM and DMARC records for every domain you send from: SPF, DKIM with OpenDKIM and DMARC.
- Backups and monitoring: mail is hard to recover once lost, and a full disk stops delivery.
If you would rather have a server built for mail, see email server hosting.
Official documentation: Postfix documentation, mailcow, Mail-in-a-Box, iRedMail and Stalwart.