For a new Linux server that needs to send and receive mail, choose Postfix unless you have a reason not to. It is modular, has a conservative security design, has clear configuration files and is widely documented. Choose Exim if you are on a platform that already uses it (Debian's default MTA package and cPanel are common examples) or if you need its very flexible routing and ACL language. Choose Sendmail mainly to maintain an existing installation; few new deployments start with it today.
All three are mail transfer agents (MTAs): they accept mail over SMTP, queue it, make routing decisions and deliver it locally or to another server. The differences lie in architecture, how you configure them, how much you can customise and how they behave under operational pressure. This guide compares them on the points that matter in production.
At a glance
| Aspect | Sendmail | Postfix | Exim |
|---|---|---|---|
| Origin | One of the earliest MTAs, 1980s | Written as a secure alternative to Sendmail, released in the late 1990s | Developed at the University of Cambridge, mid 1990s |
| Architecture | Historically a large monolithic daemon | Many small cooperating processes with limited privileges | Single main binary with a configurable pipeline |
| Configuration | sendmail.cf, usually generated from m4 macros in sendmail.mc | main.cf and master.cf, simple key = value | A single file with ACLs, routers and transports |
| Learning curve | Steep and unusual syntax | Gentle for the basics | Moderate, very powerful but easy to misconfigure |
| Typical home | Older Unix and legacy Linux | Many Linux distributions and mail appliances | Debian family default, cPanel servers, large hosting environments |
| Community and docs | Smaller today | Large and consistent | Large, strong in the hosting world |
Distributions choose their own defaults and change them, so check the packages your release ships instead of assuming. Compare also MTA, MDA and MUA roles if you are unsure which component you actually need.
Architecture and security
Postfix splits work across small programs (smtpd, qmgr, smtp, cleanup, local and others) managed by a master process. Each runs with the minimum privileges, and a failure in one does not hand an attacker the whole system. This design is the main reason administrators trust it for internet-facing servers. Sendmail traditionally ran as one large program, which made it historically exposed to a series of well known vulnerabilities; modern versions are much improved but the reputation and the complexity remain. Exim is a single program that does a great deal through its own expansion language, which gives it great power and a larger surface for configuration mistakes. Exim has had serious vulnerabilities over the years, as have the others, so whichever MTA you run, patch promptly and follow the project's security announcements.
Configuration style
The easiest way to see the difference is to set up a relay through a smarthost. In Postfix this is a few lines.
# /etc/postfix/main.cf (excerpt)
myhostname = mail.example.com
inet_interfaces = loopback-only
relayhost = [smtp.provider.example]:587
smtp_tls_security_level = encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymousIn Exim the equivalent lives in routers, transports and authenticators. On Debian the helper dpkg-reconfigure exim4-config generates it, and you can test routing without sending.
# Show how Exim would route an address
exim4 -bt [email protected]
# List the queue and see why messages are held
exim4 -bp
exim4 -Mvl MESSAGE_IDSendmail users normally edit sendmail.mc and rebuild the generated file, for example with m4 sendmail.mc > sendmail.cf and then restart. Plan for more learning time, and always test changes on a staging host. For a Postfix walkthrough see the Postfix relayhost guide.
Operations: queues, logs and tooling
| Task | Postfix | Exim | Sendmail |
|---|---|---|---|
| View the queue | postqueue -p (or mailq) | exim -bp | sendmail -bp (or mailq) |
| Flush the queue | postqueue -f | exim -qff | sendmail -q |
| Check effective config | postconf -n | exim -bP | Inspect sendmail.cf |
| Test address routing | postmap -q / sendmail -bv | exim -bt address | sendmail -bv address |
| Main log | /var/log/maillog or mail.log | /var/log/exim4/mainlog or exim_mainlog | /var/log/maillog |
Paths differ by distribution. All three can be monitored with standard log parsing, and all benefit from understanding how the queue works; see the mail queue explained.
Flexibility and features
- Routing and policy. The ACLs in Exim and routers can express nearly any policy in one place. Postfix gets there through restrictions, lookup tables and policy services, which are easier to reason about but less free form.
- Authentication and TLS. All three support SMTP AUTH and STARTTLS. Postfix and Exim integrate with Dovecot and Cyrus SASL.
- Virtual domains and users. All three support them; Postfix with lookup tables, Exim with data lookups in routers.
- Filtering. Milter support exists in Sendmail and Postfix, and Exim has its own content scanning hooks. Policy daemons are a common third route.
- Authentication of outgoing mail. DKIM signing is built into Exim, and available to Postfix and Sendmail through milters such as OpenDKIM. See authenticating a sending domain.
Which should you choose?
| Situation | Recommendation |
|---|---|
| New general purpose Linux server, application mail or internal relay | Postfix |
| Debian-based server where the default package already fits | Exim is acceptable; Postfix is a common swap |
| cPanel or similar hosting stack | Use the MTA the stack ships, which is usually Exim |
| Existing Sendmail with custom rules | Maintain, then plan a migration |
| Sending mostly through a provider | Postfix as a local relay is simple and robust |
| Complex per recipient routing and policy | Exim |
When none of them is the right tool
Postfix, Exim and Sendmail are general purpose MTAs. If your main job is high volume outbound delivery with per destination throttling, queue shaping, many source IPs and detailed metrics, a purpose built sending engine is a better fit than tuning a general MTA. Read the MTA overview including KumoMTA and hosting versus SMTP service before committing to run your own infrastructure. Running a mail server also means owning reputation, blocklist monitoring, DNS authentication and abuse handling, and many teams find that a relay service is cheaper in practice than the staff time.
Performance and resource use
All three handle the volume of a typical business server comfortably. Differences appear when one host delivers large batches to a few destinations. Postfix lets you tune concurrency per destination and the size of its queues with parameters such as default_destination_concurrency_limit and transport specific overrides. Exim offers similar control through transport options and queue runners. Sendmail can be tuned too, but the settings are less approachable. In every case the practical limit is usually external: remote servers throttle senders they do not know, so raw MTA speed matters less than reputation and sensible pacing. Measure before you tune, using real delivery logs, and change one setting at a time.
Memory and CPU use are modest for all three. The more important operational difference is how easy it is to see what the system is doing. Postfix logs are regular and easy to parse, Exim logs are rich and include per message detail, and Sendmail logs are adequate but require more experience to read quickly. Pick the one your team can debug at three in the morning.
Migration notes
- Inventory what the old MTA does: aliases, virtual domains, relay rules, TLS settings, content filters.
- Reproduce the same behaviour on the new MTA on a staging host, and test with real addresses.
- Lower DNS TTLs before switching MX records, and keep the old server accepting mail during the transition.
- Move queue contents only if needed; usually let the old queue drain.
- Validate SPF, DKIM and reverse DNS for the new host before sending production mail.
Troubleshooting
| Symptom | Likely cause | Check |
|---|---|---|
| Mail stuck in queue | Remote 4xx, DNS or port 25 blocked outbound | Queue listing and the log lines for the message |
| Relay denied | Client not authorised or not authenticated | Relay restrictions in the MTA configuration |
| Rejected by Gmail or Microsoft | Missing authentication or reverse DNS | Headers of a bounced message and PTR record |
| Config change has no effect | Service not reloaded, or generated file not rebuilt | Reload the daemon and re-run the config dump |
Prefer not to run and patch your own MTA? Relay through a managed service from Postfix, Exim or Sendmail with a few lines of configuration.
References and further reading
Frequently asked questions
Which is better, Postfix or Exim?
Postfix is the safer default for most new servers because it is modular and simple to configure. Exim is better when you need very flexible routing or run a stack such as cPanel that uses it.
Is Sendmail still used?
Yes, mostly in older installations. New deployments rarely choose it because its configuration is harder and the others are more widely documented.
Can I switch MTAs without losing mail?
Yes, if you plan it. Keep the old server accepting mail while you change MX records, and let the old queue drain.
Do I need my own MTA to send email?
Not necessarily. You can run a local Postfix as a relay to a sending service, which avoids managing reputation and IP warm-up yourself.
Which MTA is best for bulk sending?
General purpose MTAs can work at modest scale, but high volume senders usually use a purpose built engine with per destination throttling and detailed metrics.