Courier Mail Server


The Courier mail transfer agent (MTA) is an integrated mail/groupware server based on open commodity protocols, such as ESMTP, IMAP, POP3, LDAP, SSL, and HTTP. Courier provides ESMTP, IMAP, POP3, webmail, and mailing list services within a single, consistent, framework. Individual components can be enabled or disabled at will. The Courier mail server now implements basic web-based calendaring and scheduling services integrated in the webmail module. Advanced groupware calendaring services will follow soon.

The Courier mail server's source code should compile on most POSIX-based operating systems based on Linux, and BSD-derived kernels. The Courier mail server should also compile on Solaris and AIX, with some help from Sun's or IBM's freeware add-on tools for their respective operating systems.

The Courier mail server evolved out of several related projects, that merged together (more on that later). The Courier mail server implements SMTP extensions for mailing list management and spam filtering. The Courier mail server can function as an intermediate mail relay, relaying mail between an internal LAN and the Internet, or perform final delivery to mailboxes. The Courier mail server uses maildirs as its native mail storage format, but it can also deliver mail to legacy mailbox files as well. The Courier mail server's configuration is set by plain text files and Perl scripts. Most of The Courier mail server's configuration can now be adjusted from a web browser, using The Courier mail server's web-based administration module.

The Courier mail server can provide mail services for regular operating system accounts. The Courier mail server can also provide mail services for virtual mail accounts, managed by an LDAP, MySQL, or PostgreSQL-based authentication database.

Certain portions of the Courier mail server - the mail filtering engine, the webmail server and the IMAP server - are also available as separate, smaller, packages that can be used with other mail servers.


However, it is also important to note what the Courier mail server does not have or will not support:


Additional information

Here is a somewhat more detailed overview of the Courier mail server's less prominent features:

Upgrade path

The Courier mail server can be installed on systems that were previously running sendmail or Qmail. Please note that the Courier mail server will be able to support most major features of both servers, however the Courier mail server is not, and will never be a 100%-compatible replacement for either sendmail or Qmail. The Courier mail server does not implement several legacy features of either MTA, and there are no plans to implement them in the future. The key differences are:

A local mail delivery agent, such as procmail, should be used for maximum compatibility with sendmail.

The Courier mail server expects system mailboxes to be in the users' home directories. If your system mailboxes are all stored separately, in /var/spool/mail or somewhere else, you'll need to use a local delivery agent such as procmail.

The Courier mail server uses a filesystem lock on mailbox files, The Courier mail server does not support old-fashioned dot-locking. If you need dot-locking, use procmail or maildrop (included).

A configuration switch allows the Courier mail server to read $HOME/.qmail files, however the Courier mail server's implementation is not 100% identical to Qmail's. The Courier mail server's aliases file is also used to implement Qmail-style virtual domains. A simple Perl script can be used to convert Qmail's control/virtualdomains into aliases entries.

The Courier mail server supports Maildirs natively.

The Courier mail server can use the maildrop mail filter as a local mail delivery agent. maildrop is optional, but, if used, The Courier mail server will take advantage of certain maildrop-specific features which optimize local mail delivery.

Mail filters

The Courier mail server has hooks for optional, site-defined, mail filters. You'll have to write them yourself, though. The administrator-defined mail filters can block the message from being accepted by the Courier mail server (if messages comes in via SMTP, the SMTP server will reject it). The Courier mail server can also be configured to pause for a short period of time before attempting to deliver a message. If the mail filter detects a slew of duplicate messages coming in, the mail filter can block all future copies, and manually bounce the handful of copies from the queue. The system administrator can selectively enable filtering for any individual mail source (ESMTP, locally submitted mail, UUCP). The system administrator can also optionally enable recipient-specified mail filters. With recipient-specified mail filtering enabled, any local mail recipient can install an arbitrary mail filter to selectively accept or reject mail based on any criteria.

Currently the mail filtering API is not very well documented, but it's there.

ESMTP extensions

The Courier mail server implements AUTH, PIPELINING, DSN, SIZE, and 8BITMIME extensions to SMTP. The Courier mail server also includes a reference implementation of the experimental XVERP and XEXDATA extensions.

The Courier mail server is a closed mail relay by default. The Courier mail server cannot be accidentally configured as a completely open relay. A deliberate feat of stupidity is required for that to happen.


The Courier mail server does not deliver mail to domains with broken MX records. The Courier mail server also refuses to accept any mail with a return address in a domain with broken MX records.

The Courier mail server can automatically blacklist domains whose mail servers reject delivery status notifications.

Header rewriting

The Courier mail server will rewrite headers and MIME-ify messages whenever appropriate. Header rewriting logic is hardcoded in C, there is no header rewriting language as in sendmail. An interpreted language imposes a drastic speed penalty. The rewriting library is fairly simple, and the the standard rewriting rules will do for most situations.

The Courier mail server rejects messages with badly-formed or missing MIME headers. The Courier mail server rejects messages containing 8-bit characters in the headers, or messages that contain 8-bit content, but do not have the required MIME headers. Accepting malformed messages of that kind can result in the Courier mail server itself sending mail that violates the relevant RFCs, therefore Courier mail server will simply reject improperly-formatted messages. There are well-defined RFC standards that explicitly spell out how mail containing 8-bit content or 8-bit headers should be encoded, and those standards will have to be properly implemented by anyone that wishes their mail to be accepted.


Message scheduling, dispatching, and the actual transport mechanism are completely modularized. Different message transport mechanisms such as UUCP can be implemented in a simple plug-in fashion, however some C coding will be required.

Message scheduling

The Courier mail server supports VERPs, multiple recipients per message, and RFC1894-compliant delivery status notifications.

Load limiting

You can set a maximum number of messages to deliver simultaneously to the same host. This, in fact, is strongly encouraged so that a single nonfunctioning domain does not take up all available delivery slots. Rate limiting is implemented in the main scheduler, and applies to any transport mechanism, not just ESMTP.

Automatic restarts and garbage cleanup

The Courier mail server's scheduling engine restarts itself automatically, on a regular basis. This helps with memory fragmentation. The Courier mail server tries to restart itself during periods of system inactivity.

Smart organization of the message queue and temporary directories

The Courier mail server automatically creates subdirectories when necessary, and deletes them when they're empty. When there's a sudden peak in the number of messages added to the queue, directories used to store the messages grow in size to accomodate the additional entries. On many file systems, once those messages are deleted, the empty slack space in the directory is not reclaimed, and actually slows down subsequent directory operations. The Courier mail server automatically removes empty directories, reclaiming the slack space.

Smart installation layout

The Courier mail server's configuration script will install the Courier mail server into /usr/lib/courier by default. Everything will go into several subdirectories there: the actual binaries, configuration files, the mail queue, manual pages, and auxiliary support files. Optional configuration switches allow pretty much every major subdirectory to be relocated anywhere else. For example, the Red Hat RPM package for the Courier mail server relocates the configuration files to /etc/courier, the manual pages to /usr/man, and the mail queue to /var/spool/courier.

Mailing lists

The Courier mail server can implement both sendmail and qmail-style address aliases. De-duping of sendmail-style aliases is automatic. The Courier mail server source distribution also includes a complete mailing list manager.