Exim is a free, open-source mail transfer agent (MTA) for Unix-like operating systems that receives messages over SMTP, decides where each one should go and delivers it locally or to remote servers. In email infrastructure, it occupies the same role as Postfix or Sendmail and is one of the most widely deployed MTAs on the public Internet.
Exim was created at the University of Cambridge and is distributed under the GNU General Public License. It is the default MTA on Debian and on many shared hosting control panels such as cPanel, which explains its large footprint. Its defining trait is a single, highly programmable configuration file that lets administrators express almost any routing or filtering policy.
How Exim processes a message
Exim handles every message in three stages: reception, routing and transport. During reception, the SMTP listener or a local command such as sendmail accepts the message, runs access control lists and writes it to the spool directory as a header file and a data file.
A queue runner then picks up each spooled message and passes every recipient address through an ordered list of routers. The first router that accepts an address decides how it will be delivered and assigns a transport, which performs the actual delivery, for example over SMTP to another server or into a local mailbox.
The table below lists the main building blocks an administrator configures in Exim.
| Component | Role | Typical example |
|---|---|---|
| Main section | Global options for the daemon | Hostname, listening ports, TLS certificate |
| ACLs | Accept, defer or deny during the SMTP dialogue | Reject unknown recipients at RCPT time |
| Routers | Decide how each address is handled | dnslookup for remote domains |
| Transports | Carry out the delivery | remote_smtp, appendfile for Maildir |
| Retry rules | Control redelivery after temporary failure | Retry every 15 minutes for 4 days |
| Rewrite rules | Change addresses in headers or envelope | Map internal names to public domains |
Temporary failures leave a message on the queue, and retry rules decide when Exim tries again. When the retry limit expires, Exim generates a bounce message to the sender explaining the permanent failure.
Routers, transports and string expansion
The flexibility of Exim comes from its string expansion language, which lets almost any configuration option be computed at run time. Expansions such as ${lookup} query flat files, DBM databases, LDAP, MySQL, PostgreSQL or DNS, so routing tables can live in external data sources.
Routers are evaluated strictly in order, and conditions such as domains, local_parts and condition decide whether each router applies. This ordered model makes complex policies possible, but it also means a misplaced router can silently capture addresses intended for another rule.
| Router driver | What it does | Common use |
|---|---|---|
| dnslookup | Looks up MX records for a domain | Delivery to remote Internet domains |
| manualroute | Sends mail to listed hosts | Smart host or SMTP relay setup |
| redirect | Expands aliases and forward files | Alias tables, .forward, Sieve-style filters |
| accept | Accepts the address unconditionally | Final local delivery to mailboxes |
| queryprogram | Asks an external program for routing | Custom integration with other systems |
Exim compared with other mail transfer agents
Exim differs from its main competitors in architecture and configuration style rather than in protocol support, since all mainstream MTAs implement SMTP, TLS and modern authentication checks. The choice usually depends on the operating system default, the hosting panel and the administrator’s experience.
| Property | Exim | Postfix | Sendmail |
|---|---|---|---|
| Architecture | Mostly monolithic binary | Multiple cooperating processes | Monolithic binary |
| Configuration | One expandable file | main.cf and master.cf | m4 macros compiled to sendmail.cf |
| Flexibility | Very high | High with lookup tables | High but complex |
| Security record | Several serious CVEs | Strong record | Weak historically |
| Typical home | Debian, cPanel hosting | Many Linux distributions, macOS | Legacy Unix systems |
Exim handles only message transfer. Mailbox access through IMAP or POP3 is left to a separate server such as Dovecot, which also commonly provides SMTP authentication to Exim.
Security and anti-spam features
Exim enforces most mail policy through access control lists that run at each SMTP stage, such as connect, HELO, MAIL, RCPT and DATA. Rejecting spam during the SMTP dialogue is preferable to accepting and bouncing it later, because it avoids backscatter to forged senders.
- DNSBL checks with the
dnslistscondition block known spam sources at connection or recipient time. - Built-in DKIM signing and verification, plus SPF and DMARC support when compiled with the relevant libraries.
- STARTTLS for encrypted server-to-server transport and authenticated submission on port 587.
- Content scanning hooks for SpamAssassin and ClamAV through the
spamandmalwareACL conditions. - Rate limiting with
ratelimitto stop compromised accounts from sending floods.
Because Exim is widely exposed, it is a frequent attacker target. Critical remote code execution flaws were disclosed in 2019 and again in later years, and attackers exploited unpatched servers at scale. Prompt patching and running supported versions are therefore essential.
Operating and troubleshooting Exim
Exim ships with command-line tools that make queue inspection and debugging straightforward. Administrators who know them can diagnose most delivery problems without reading raw spool files.
| Command | Purpose |
|---|---|
| exim -bp | List messages on the queue |
| exim -bt address | Test how an address would be routed |
| exim -bh IP | Simulate an SMTP session from an IP address |
| exim -qff | Force a delivery run of the whole queue |
| exiwhat | Show what running Exim processes are doing |
| exigrep | Search logs and group lines per message |
Common mistakes include running an open relay through overly broad relay_from_hosts settings, missing reverse DNS for the sending IP and letting the queue grow unchecked after a spam outbreak. A growing frozen queue is often the first visible sign of a compromised account.
A non-technical view
Exim is a digital post office sorter. When an email arrives, Exim reads the address, decides whether the message stays in this building or travels to another post office and then sends it on its way.
What makes Exim special is how precisely its rulebook can be written. Administrators can describe almost any sorting rule, which is powerful but demands care, because one wrong rule can send mail to the wrong place.
A concrete example
A web hosting company runs several hundred customer domains on Linux servers managed through a control panel that installs Exim by default. Each server receives inbound mail for its domains and sends outgoing mail generated by customer websites and mail clients.
The administrators configure ACLs that check two DNS blocklists at RCPT time, verify DKIM on incoming mail and sign outgoing mail with per-domain DKIM keys. A ratelimit rule caps each authenticated user at 200 messages per hour, and messages above the limit are deferred rather than accepted.
When a customer’s password is stolen, the rate limit stops the attacker after the first few hundred messages, and exim -bp immediately shows the deferred backlog. The team removes the queued spam, resets the password and avoids having the server IP listed on a blocklist, so legitimate customer mail keeps flowing without interruption.