LWN.net Logo

A comparison of Mail Transfer Agents - Part One

August 23, 2006

This article was contributed by Dan Shearer

[ Editor's note: Mr. Shearer is maintaining an updated version of this article on his web site.]

Mail Transfer Agents - Tool for the Job

For a lot of people the choice of the Mail Transfer Agent is important. The wrong choice can mean lost time and money, lower reliability and increased risk to networks.

Debates over MTAs sometimes last for years, and this article covers the main points that come up over and over. Unfortunately, apart from this article there are no general comparisons of MTA characteristics on the Internet, and even very little benchmarking. The remarks here are personal opinions drawn from readily-verifiable facts and subjective comments drawn from experience. Nearly every MTA has a vociferous and sometimes combative group of supporters, not always including the principal authors of the MTA.

It is easy to see why administrators care about which MTA they use. Large installations require a lot of time spent tuning the MTA, and for any site email is without doubt the most important use of the Internet. [1] End users can get by without a web site or a browser for a little, but without email business stops. And so countless administrators invest time in learning how to tweak their internet mail delivery tool in order to meet their various goals. But which tool should they use when?

Most Internet email seems [2] to be delivered by one of four MTAs:

There are other worthy free MTAs to talk about, such as zmailer and smail3, but since they are not so widely used I decided to omit them. There are some unworthy MTAs too, these I am delighted to omit.

How To Compare MTAs

Each of these four widely-used MTAs have broadly similar features. All of them can handle large amounts of mail; can interact with databases in many formats; have an extensive knowledge of the many SMTP variants in use; are not trivially exploitable; have the source code available in a free manner; have third-party documentation available; and have significant user communities. They even have logos!

There are some assumptions implicit in the rest of this article. If you are looking for a product that presents an administrative interface and performance results similar to Microsoft Exchange or Lotus Notes, this document is not for you. I do not believe either of these products and their aspiring competitors can be classed as MTAs, since they attempt to address dozens or hundreds of other functions besides delivering mail. On the other hand, if you want some guidance for selecting between credible alternatives for an important mail hub, read on.

No MTA can score well in every way of measuring an MTA. The needs of users vary greatly and some criteria are mutually orthogonal. Commonly cited MTA selection criteria are:

  • Ease of administration
  • Security
  • Performance
  • Long-term viability

Design features decide how much each MTA meets these criteria. But since opinions vary widely there are many equally valid different comparisons. Contradictory examples of these features are:

  • single configuration file, so everything is in one place
  • many single-purpose and optional configuration files
  • minimal and careful syntax
  • powerful embedded scripting language
  • maximum code stability
  • source code contributions regularly incorporated
  • minimum possible features added
Just about every mail delivery scenario can be met, in one way or another, by all four MTAs. So there is no one right answer.

 

qmail

qmail Summary
[Qmail logo]
MTA details
Website: http://www.qmail.org
Out since: 1996
Goals: Security; Simplicity; Efficiency
Non-goals: Unix conventions, ease of admin
License: not open source or free
Classification
Config: Many simple control files
Releases: Never (since 1997!)
Commiters: 1
Maj. contributors: 0
Flexibility: Very, if you study hard
Subjective Comments
Administration: Buy one of the books!
Security: Good record
Performance: Excellent
Community: Smallish but very active
Sendmail compatibility: Good

Note: qmail is unmaintained: the author has not released since 1997 and does not permit others to make releases. It is also not Open Source Software, although the source is visible and usable within very tight restrictions.

So why should anyone care about qmail? Perhaps they shouldn't in 2006, but there were good reasons to notice qmail in its first five years of life:

  • qmail had a radical and seemingly impregnable [3] security design.
  • qmail solved in one stroke all the problems of the hideous BSD mailbox format with the Maildir message format.
  • qmail was fast. If your only other choices were Sendmail or smail, and high-volume list management was done on IBM mainframes, qmail was a welcome alternative.

These days these advantages are at least equaled by other MTAs, and Maildir has become Maildir++. Yes, qmail taught MTA users and developers some lessons. No, qmail isn't a realistic option these days: it doesn't support modern mail standards or even IPv6; it isn't maintained; it isn't possible for someone else to maintain it; its many oddities are increasingly painful relative to any benefits qmail has.

In 2006 a qmail maestro is someone who knows which collection of patches to apply to a nine year-old program. In 2004 a group of qmail experts put together netqmail, a distribution of qmail patches. But even that hasn't been touched for two years, and now there are patches for the netqmail patch collection.

qmail is still used on some very high-volume sites, and there are still people who strongly believe that qmail is very correct code. qmail source is legal to copy, use and patch. The author's licensing analysis is thought-provoking but thus far irrelevant to the copyright debate.

qmail comes with more free personality than nearly any other program -- what other MTA is likely to ask "hath the daemon spawn no fire?" when it can't start? See qmail.org for the source code.

Postfix

Postfix Summary
[Postfix logo]
MTA details
Website: http://www.postfix.org
Out since: 1997
Goals: Security; Easy of use; Standards
Non-goals: General purpose MTA
License: IPL (a disused license)
Classification
Config: Single control file
Releases: Infrequent
Commiters: 1
Maj. contributors: 3
Flexibility: Easy to change
Subjective Comments
Administration: Intermediate, good docs
Security: Good record. Credible team.
Performance: Excellent
Community: Medium-sized
Sendmail compatibility: Very good

Design goals: Secure, easy to administer, efficient.

Postfix is, like qmail, written by a prolific freeware security specialist, this time Wietse Venema although the result is a recognizable ordinary Unix suite of programs. It is almost entirely the work of Wietse, with occasional contributions in isolated areas such as integrating the Transport Layer Security (TLS) libraries. Releases come in bursts, with very small improvements at times. Release management is by Wietse personally.

Postfix has a monolithic main configuration file like Exim and Sendmail. It is table-driven, everything is a table and a table can be represented in all kinds of ways from plain text files to databases to relational databases and more. It handles regular expressions in many contexts, using the Perl Compatible Regular Expression library developed for Exim. Postfix consists of about 150k lines of code.

Postfix fits somewhere between qmail and Exim. It consists of several programs (but fewer than qmail), and has a monolithic configuration file. Postfix has a strong emphasis on security, but not to the extent of imposing unusual Unix management practices. Postfix is quite flexible in its configuration file, but not to the extent of Exim. Postfix postdates qmail and follows a vaguely analogous security approach, an approach which was relatively much more important in 1997.

Postfix has been measured by many as being extremely fast, and I have found it very efficient. My impression is that it is more efficient than Exim but not to a noticeable degree even with very high load. Postfix and qmail seem to use about the same amount of memory but by deliberate design qmail uses more bandwidth than Postfix because qmail only ever sends a single message per SMTP session even if there are multiple messages going via the same host. Postfix is quite Unix-centric with its secure design and is not maintained on very non-Unix platforms such as Windows.

Postfix is, like Exim, a drop-in replacement for Sendmail. Besides just implementing the sendmail command line interface, Postfix is compatible with Sendmail milters, an impressive and unequaled achievement to those that have investment in such modules.

The Postfix community is very active. Online documentation is quite good but scattered. There are three Postfix books in English. See postfix.org and postfixwiki.org for the source code.

Footnotes

1. Possibly changing fast since in 2006 many young people almost exclusively use instant messaging or similar communication models

2. Established by talking to the people who run busy mail hubs in public ISPs, lurking in the email community and from taking small samples of what is running behind the world's MX records. However there is an astonishing lack of information about what SMTP servers are actually in use, with no equivalent to the Netcraft Web Survey. Dan Bernstein last ran a limited survey of one million hosts in 2001, which he wrote up here without publishing his code. Many administrators do not change the MTA that comes with their Unix distribution, and popularity contests such as the Debian Popularity Contest are flawed in many ways.

3. The Georgi Guninski vulnerabilities have been multiply confirmed, and one of them is a root vulnerability. DJB rejects this in typical style claiming it is an improbable configuration, but security analysis is always seeking improbable setups! DJB is wrong, but qmail still has an outstanding record.

More to come

The second half of this article will be posted on next week's LWN.net development page, it will contain a detailed look at Sendmail and Exim come to some conclusions about which MTA is best.

More articles by Dan Shearer are available here.


(Log in to post comments)

A comparison of Mail Transfer Agents - Part One

Posted Aug 24, 2006 9:47 UTC (Thu) by job (guest, #670) [Link]

qmail may be "ready" in the author's view, but that hasn't stopped the community from developing it further. Apart from the mentioned netqmail, there is also several swap-in components to take care of spam and virus filtering for example. qmail is very modular and it is easy to do this.

There is also qpsmtpd, which technically may be counted as anohter MTA, but which fits in nicely with the rest of qmail and is extremely flexible. It is written in Perl, performance is good enough on modern hardware.

I think you are being unfair to DJB, "wrong" is harsh. Yes, there is a problem, but not with the recommended configuration. He may be smug but the code is excellent. I wish all software was nearly as secure.

A comparison of Mail Transfer Agents - Part One

Posted Aug 24, 2006 11:42 UTC (Thu) by dark (subscriber, #8483) [Link]

"Nobody gives gigabytes of memory to each qmail-smtpd process" is a falsifiable statement. If it turns out to be false, will DJB pay out the $500?

A comparison of Mail Transfer Agents - Part One

Posted Sep 5, 2006 13:19 UTC (Tue) by job (guest, #670) [Link]

I think the problem has to be in the default configuration. DJB never
claimed that it was impossible to set up qmail insecurely if you really
wanted to. You can even use it as an open relay if you want.

I just love Exim

Posted Aug 24, 2006 12:13 UTC (Thu) by pilif (guest, #3857) [Link]

Hi,

it's a nice idea to actually go ahead and review the different MTAs out there and I'm looking
forward to seeing how the different applications will perform against each other.

Personally, this is a non-issue for me as I've done this same evaluation ages ago (well... back in
2000) and for me only one candidate came close to meeting the requirements: Exim.

I was setting up a webbased email system that had to be independant of unix users and needed
to have a database driven user management system following a custom schema. Exim was the
only MTA filling in the MTA part of the complete solution which actually allowed me to do what I
needed without the need to apply external patches (and thus being unable to use the
distributions package system).

Back in 2001, I revised my solution to create a general purpose email system handing multiple
domains (my solution in 2000 worked with just one domain). This meant replacing Cyrus with
Courier for IMAP access and rewriting the exim configuration file a bit.

Still, only exim provided me the flexibility to do what I wanted without the need to patch around
exim itself. I posted my configuration to the usenet where it got picked up by Oliver Siegmar,
who created a real project for it (www.xams.org).

During all the years I kept having looks at other MTAs and I never ever found a comparable
solution. Exim is easy to configure, extremely flexible in matters of provided options and handles
tons of emails per day without flaw.

And security-wise its track record isn't all that bad either.

For me and my needs, there's only one MTA and that's Exim.

Whenever I setup an other server in need of a local MTA, the first thing I do is to install exim as
that's the tool I know how to work with (though I don't need all the SQL bells and whistles there
of course).

Philip

I just love Exim

Posted Aug 24, 2006 12:57 UTC (Thu) by ahoh (guest, #17291) [Link]

Could you drop a comment why Postfix lost out in your evaluation?
I use both and I always have the feeling that the configuration is more
elegant.

As the decision is upcoming for the next mail server, I am naturally
curious about the different aspects.

AFAIK Postfix has a slightly better security record as well (not to a
degree that I would weight too much in the decision making process).

I just love Exim

Posted Aug 24, 2006 13:36 UTC (Thu) by pilif (guest, #3857) [Link]

Hi,

back in 2000, Postfix didn't have any possibility to get its user information from an external
database. What you had to do was to patch in some custom patch which would have made it
impossible for me to use the distribution package management system. Well. Not impossible, but
it would have been much harder to work with.

In 2001, when I had my second look, there was some database-solution but it wasn't nearly as
flexible as Exim was and it forced you into a certain schema.

With exim, I can create completely custom queries to the database and I don't need to emulate
unix UID or stuff like that. Exim treats a user looked up via SQL just the same as an user found in
/etc/passwd or whererver else.

This means that I was able to completely integrate Exim into a normalized schema of my liking
without the need to midify anything but /etc/exim.conf

My data model consists of

- sites
- domains (each site can have multiple domains)
- users (each site can have multiple users)
- aliases (each site can have multiple aliases)

So I can have a site named lipfi to which the domains lipfi.ch and gnegg.ch are assigned to. Then
I can have the user pilif in the site lipfi which means that this user can get email adressed to

pilif@lipfi.ch
pilif@gnegg.ch

I can also have an alias in the site lipfi that assigns * (catchall) to pilif, meaning that the same
account is reachable via [whatever]@(gnegg|lipfi).ch

All that based on my completely custom (MySQL) Schema with just a few lines of customized
code in exim.conf. The configuration even creates maildirs for later use with Courier, sets quota
stored in the database and uses an exim filter per user to prefilter incoming messages *without
spawning and MDA process*.

That and the extremely well optimized MySQL-Schema make this configuration very, very fast,
capable of handling a very large amount of mail while still providing as much flexibility as I ever
want.

When I was last looking at postfix, it treated SQL-Users as aliases which had to be mapped to
some "real" users.

So this is why I went and still am going with Exim whenever I can.

Btw, this configuration uses Courier for access to the mailboxes. I created a custom authdaemon
in Perl which courier talks to to authenticate users. Users log in to the IMAP server with
<username>@<domain> and my custom authdaemon uses the domains-table to get the right
site to find the right username and then leads courier to the right maildir (previously created by
exim).

All this works without patching any upstream package.

Philip

Exim & Postfix flexibility

Posted Aug 24, 2006 18:33 UTC (Thu) by rfunk (subscriber, #4054) [Link]

When I was last looking at postfix, it treated SQL-Users as aliases which had to be mapped to some "real" users.

Must've been before virtual support.

What you were looking for sounds a lot like what I implemented with Postfix and Postfix Admin (as well as dovecot).

I used to like Exim for its simplicity and power, but Postfix has matured quite a bit over the years, so at this point I see Exim as powerful but complex, while Postfix gets the points for simplicity and power.

Exim & Postfix flexibility

Posted Aug 24, 2006 18:57 UTC (Thu) by Alan_Hicks (guest, #20469) [Link]

I concur. You really can't go wrong with either, but postfix has made some significant progress over the years. It used to be that if you wanted to do anything fancy, you had to use sendmail (or later exim) and the configuration was terribly hard. MTAs are one of those things that are constantly changing though, and postfix has grown up a lot since the grand-parent last seriously evaluated it.

Today postfix has excellent virtual user support and supports just about every authentication mechanism you would want. As for the article itself, the writer mentions that postfix docs are "scattered" around. I can't say that I've ever had a problem finding documentation for postfix, and what I do find is hands-down some of the best documentation I've ever seen for free software. The man pages are excellent (every bit as good as you would expect from the BSD world) and the txt and html docs included with the source code will walk you through just about everything.

For good dead trees documentation and an overview of how to do things with postfix, I found the O'Reilly book "Postfix - The Definitive Guide" by Kyle D. Dent to be excellent.

Exim & Postfix flexibility

Posted Aug 25, 2006 8:27 UTC (Fri) by kleptog (subscriber, #1183) [Link]

The thing that annoys me about Postfix while looking at the config file is that it's a lot of options, but from those options I have no idea how the system actually works. With Exim the config file describes the process taken to deliver a mail, from beginning to end. Take for example processing of the .forward file.

In Exim there's a director down the end that specifies the filename and how to handle it (permissions, user, etc). So I know where in the mail delivery process it appears. I can ask for it to check for the .forward files in a central directory, or check in a database if the user is allowed a .forward file. The default postfix configuration doesn't seem to mention the .forward file at all.

If someone comes along wanting special mail routing for domain X, I can just add a stanza matching that domain and add the rules. I can decide if it comes before or after the virtual tables, or anything else.

Maybe postfix can do this too, but from looking at the config file I certainly don't get that impression. It seems to be full of implicit rules, and I hate that.

Exim & Postfix flexibility

Posted Aug 25, 2006 8:59 UTC (Fri) by ahoh (guest, #17291) [Link]

When I was new to Postfix (that was at a time when the postgresql patch
was a brand new thing) I found the online documentation very helpful. And
it still is.

Don't bother too much with the comments in the config files (they are only
comments after all, usually only focusing on a very specifiy aspect). They
are helpful if you have allready some routine in running Postfix.

Have a look at http://www.postfix.org/documentation.html and dig through
the problem you want to solve there. I bet most of what you want to
configure is described there with the big picture and an overview of all
the corner cases it touches.

Postfix uses more then one file and several databases. That IS different
from a single config file to catch all.

Exim & Postfix flexibility

Posted Aug 25, 2006 18:15 UTC (Fri) by tsr2 (subscriber, #4293) [Link]

If there's a solution there (at http://www.postfix.org/documentation.html) for what I wanted to do with an MTA, it was far from obvious. The solution was relatively easy to find in the Exim documentation, so I went with Exim. IMHO the Exim documentation is significantly easier to use.

As someone who had never set up a proper MTA before, I was quite happy to set up Exim for my work, based on the available documentation, whereas I would not have been happy to do the same with postfix.

I can always find what I need in the Exim Specification or the FAQ, whereas I couldn't easily find what I needed in the postfix docs.

Exim & Postfix flexibility

Posted Aug 25, 2006 12:14 UTC (Fri) by rfunk (subscriber, #4054) [Link]

I like the fact that Postfix doesn't need everything in the config file,
just the stuff different from the default. It keeps simple
configurations simple. That's why I consider Exim and Sendmail to be
more complex to configure.

If you want a config file with *everything*, run the postconf command.
It shows the complete current configuration.

A comparison of Mail Transfer Agents - Part One

Posted Aug 24, 2006 18:39 UTC (Thu) by rfunk (subscriber, #4054) [Link]

The description of Postfix as having a "single control file" (presumably
main.cf) seems to forget about master.cf. It generally doesn't need as
much attention as main.cf, but it's there.

Of course there may also be other files for various tables or database
access parameters, but that's also true for sendmail, the classic "single
control file" MTA.

Postfix code metrics

Posted Aug 24, 2006 18:44 UTC (Thu) by alanjwylie (subscriber, #4794) [Link]

Wietse recently posted a graph showing the growth of Postfix's
lines of code, with Sendmail for comparison

http://archives.neohapsis.com/archives/postfix/2006-07/17...

Not fair with qmail

Posted Aug 24, 2006 21:30 UTC (Thu) by sergioag (guest, #38848) [Link]

Surely the author has never read about qmailrocks (http://www.qmailrocks.org). It includes all the patches needed for making qmail a modern MTA, such as Exim or Postfix. There are some other patches (most notably John Simpson's all-in-one qmail patch) which add many other nice features such as IPv6 (which the author says qmail doesn't have in any form), SPF and my others.

I would recommend the author to investigate a little bit more about qmail and he'll write a totally different thing about qmail.

Not fair with qmail

Posted Sep 17, 2006 13:00 UTC (Sun) by jae (guest, #2369) [Link]

Quite fair. Check the comments... I remember about 3 posts mentioned some cool patches for qmail. Which the author admits too, there are patches. *Patches*. Unlike the competition (Exim, Postfix), it's not *included* in the actual software, but *only* available as patches.

Courier

Posted Aug 25, 2006 9:13 UTC (Fri) by cate (subscriber, #1359) [Link]

I don't see courier. The courier suite include the well know IMAP server, a POP server (both also with -SSL version), but also a MTA server, a webmail application and a web administration interface. All modules are optional, but all ot them use Maildir folders.

Courier

Posted Sep 7, 2006 12:56 UTC (Thu) by ringerc (subscriber, #3071) [Link]

I think you'll find that Courier is included via this comment:

There are some unworthy MTAs too, these I am delighted to omit.

That is certainly my own sentiment on the matter. It has its place for simple installations but is hopelessly limited for many uses and rather archaic too. I'm not a fan (I now use Postfix with Cyrus IMAPd and am extremely happy with it, though initial setup of cyrus is certainly not as easy as it could be).

Of course to a large extent it depends on what your needs are.

A comparison of Mail Transfer Agents - Part One

Posted Aug 25, 2006 11:37 UTC (Fri) by melo@simplicidade.org (guest, #4380) [Link]

There is also another qmail-based release that was not mentioned and that is commonly used by
ISP's: qmail-ldap. See http://www.nrg4u.com/ for more info.

Best regards,

Qmail backscatter spam

Posted Aug 31, 2006 8:18 UTC (Thu) by copsewood (subscriber, #199) [Link]

Quote from: http://zgp.org/pipermail/linux-elitists/2005-November/011...

"I could nitpick a few things, but it's probably better to point out
qmail's biggest crime: backscatter spam. By deliberate design it will
accept all mail for its domains, doing no recipient validation in the
SMTP dialogue. Then if a user does not exist, a bounce is generated,
almost always spamming the mailbox of an innocent victim (forged
envelope sender.)"

I don't think DJB accepts this one as a security hole either. AFAIK, there
exist a growing number of sites which will blacklist a SMTP backscattering relay for the same reasons they will blacklist a promiscous one. So this unfixed vulnerability could have an increasingly detrimental effect on your ability to operate a viable mail service.

To be secure in this respect, email to a non-existent address within one of your domains should always be rejected and never bounced.

Qmail backscatter spam

Posted Aug 31, 2006 17:00 UTC (Thu) by RussNelson (guest, #27730) [Link]

The solution to this problem is not to enable dictionary attacks, but is instead to not reply to forged emails. If an ISP claims to not want backscatter spam, and yet isn't signing emails using DomainKeys, then their claim is not plausible.

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds