Exim: what this mail server is and how it works

How it receives, routes and delivers your emails, how it differs from Postfix and Sendmail, and what to watch so it doesn't end up on a blacklist

If you manage a Linux server or a cPanel hosting account, your emails are very likely going out through Exim, even if you’ve never configured it.

It’s one of the most widely used mail servers in the world and, at the same time, one of the least known outside technical teams. Here’s what it is, how it works and how it differs from Postfix and Sendmail.

What is Exim?

Exim is an MTA (Mail Transfer Agent), a program that receives, routes and delivers email between servers using the SMTP protocol. It’s free software, licensed under the GPL, and runs on Linux and Unix systems.

It was created by Philip Hazel at the University of Cambridge in 1995. Its name comes from EXperimental Internet Mailer, although it stopped being an experiment decades ago. Today it comes preinstalled on many distributions and on most cPanel servers.

How does Exim work?

When a message reaches the server, the process follows four steps:

  1. Reception. The MTA accepts the message over SMTP, from another server or from a local application, such as a PHP website.
  2. Checks. Access control lists (ACLs) decide whether to accept or reject it: who is sending, from which IP, whether they’re authenticated, whether it passes the spam filters.
  3. Routing. The routers decide where it goes: to a local mailbox, to another server on the internet or to an intermediate server (smarthost).
  4. Delivery. The transports handle the delivery. If the destination doesn’t respond, the message stays in the queue and is retried later.
How Exim works: the message is received over SMTP, checked with ACLs, routed with routers and delivered with transports or retried from the queue

Send your campaigns without maintaining a mail server

Double opt-in, SPF and DKIM from the dashboard, and bounces that are removed automatically. The free account lets you send 80,000 emails a month to 20,000 contacts.

Main features

Highly configurable. Everything is controlled from a single configuration file, with its own language that allows very fine-grained rules.

Powerful ACLs. They let you filter by sender, recipient, IP or content and combine this with antivirus software and spam filters such as SpamAssassin.

Database integration. It can query MySQL, PostgreSQL or LDAP to find out which mailboxes exist or which users are allowed to send.

Security. It supports TLS, SMTP authentication, DKIM signing and SPF checks.

Exim, Postfix and Sendmail: differences

All three are open-source MTAs, but each has its own profile:

EximPostfixSendmail
Year199519981983
ConfigurationOne file, very flexibleSeveral files, simplerComplex and dated
Where it’s usedcPanel and many hosting providersLinux servers in generalLegacy systems
StrengthCustom rulesSecurity and performanceCompatibility

If you run a cPanel hosting account, you’ll usually stick with the one it comes with. If you’re setting up a server from scratch, Postfix is usually easier to maintain.

Basic Exim commands

These are the most commonly used commands for checking the mail queue:

CommandWhat it does
exim -bpLists the messages in the queue
exim -bpcCounts how many messages are in the queue
exim -M IDForces delivery of a message
exim -Mrm IDRemoves a message from the queue
exim -qffForces a retry of the whole queue

A queue that keeps growing usually points to a problem: destinations rejecting your emails, a blacklisted IP or a compromised account sending spam.

Exim and security

This MTA has had serious vulnerabilities. The best known, from 2019 (CVE-2019-10149), allowed commands to be run on the server remotely and was exploited on a massive scale. That’s why it’s best to always keep it up to date.

Configuration is another risk. A poorly configured server can become an open mail relay that forwards spam from anyone. That sends your IP straight to the blacklists.

Exim security: keep it up to date, prevent it from becoming an open relay, use TLS and SMTP authentication, and sign with DKIM

Your own mail server and email marketing

An MTA is meant to deliver a server’s email, but it isn’t designed for campaigns. Sending thousands of emails from your own server means you have to manage IP reputation, warm-up, bounces, unsubscribes and Gmail and Outlook limits.

The usual approach is to use it for the server’s email and leave bulk sending to a platform. You can also configure it as a smarthost client, so that all outgoing email goes through an external service, as we explain in the article on SMTP relay servers and smarthosts.

How Mailrelay Helps You

With Mailrelay, you don’t need to maintain your own server to send campaigns. Sign-ups use double opt-in, hard bounces are flagged and stop receiving emails, and you can set up SPF and DKIM for your domain from the dashboard.

If your website or application sends email, you can use Mailrelay’s SMTP as a smarthost. It’s included in the Standard and Enterprise plans, and the free account comes with a 30-day trial. For transactional emails and campaigns, you get human support on every plan.

Use Mailrelay as your server’s smarthost

SMTP on Standard and Enterprise, a 30-day trial on the free account and human support on every plan.

Frequently Asked Questions

Is Exim free?

Yes. It’s free software licensed under the GPL and can be used and modified at no cost.

Which is better, Exim or Postfix?

It depends on how you use it. Exim is more flexible and is the standard on cPanel. Postfix is simpler to configure and very secure by design. Both are solid options as long as they’re kept up to date.

How do I know if my server uses Exim?

On Linux, the exim -bV command shows the installed version. If it responds, you have your answer. The headers of the emails it sends usually mention it too.

Key takeaways about Exim

It’s a flexible, free mail server that’s widely used by hosting providers. Properly configured and kept up to date, it delivers your email without any problems. For email marketing campaigns, however, it pays to rely on a platform that takes care of reputation, bounces and unsubscribes.

Related entries