What is it
Postfix and Exim are the leading Mail Transfer Agents (MTAs) in the Unix world. Postfix was designed as a secure, modular alternative to Sendmail. Exim focuses on maximum flexibility and the ability to implement complex routing logic within a single configuration file.
| Parameter | Postfix | Exim |
|---|---|---|
| Architecture | Modular (multiple processes) | Monolithic (single binary) |
| Security | High (privilege separation) | Moderate (runs as root for many tasks) |
| Configuration | Simple (key = value) | Complex (scripting language) |
| Performance | High with large queues | Degrades with complex logic |
| Popularity | Default in Debian/Ubuntu | Default in cPanel/DirectAdmin |
Performance
Postfix utilizes a multi-process architecture. Each stage of mail processing (receiving, filtering, delivery) is handled by a separate daemon with minimal privileges. This allows efficient use of multi-core CPUs and handling of thousands of messages per second. Exim spawns a new process for each incoming connection via fork(). Under extreme loads (over 100 msgs/sec), Exim's process creation overhead is higher compared to Postfix's daemon pool.
Configuration & complexity
Postfix settings are split into two files: main.cf (parameters) and master.cf (services). The syntax is declarative, minimizing the risk of human error. Exim uses a single configuration file that supports logical conditions, loops, and Perl integrations. This allows for any routing logic without external scripts but makes the config hard to read. Example of sender restriction in Postfix: smtpd_sender_restrictions = permit_mynetworks, reject_unknown_sender_domain.
When to choose what
- Postfix: Corporate mail servers, high-load relays, anti-spam gateways. Ideal where stability and predictability are paramount.
- Exim: Shared hosting with thousands of domains requiring specific logic per user, or systems with non-standard mail routing (e.g., dynamic IP rotation for newsletters).
Cost / licensing
Both products are free and open-source. Postfix is distributed under the IBM Public License 1.0 (and newer MPL 2.0). Exim is licensed under the GNU GPL, allowing free modification and distribution.
Ecosystem & integrations
Postfix integrates seamlessly with Dovecot via SASL and Milter filters (SpamAssassin, Rspamd). Database support (MySQL, PostgreSQL, LDAP) is implemented through separate modules. Exim has built-in support for DB lookups and text files, simplifying integration with hosting control panels. For monitoring, Postfix users typically use pflogsumm, while Exim users rely on the built-in eximstats utility.
Verdict
Postfix is the best choice for 90% of infrastructure tasks due to its out-of-the-box security and ease of maintenance. Exim should be chosen only when complex programmatic mail processing is required at the MTA level that cannot be achieved by standard means.