This page is directed to those Exim-users which have already installed this MTA (Mail Transport Agent) but doesn't had the time to read the (admittedly long) docs but missed some of the capabilities of this great program.

This is not a documentation how to set up Exim, but how to enable some useful features. While manipulating the configuration file be sure to stop accepting mails (by setting up a firewall rule, or stopping fetchmail or whatever) in order to avoid losing mails!


When a mail is sent, Exim adds a "From: " line to the header. The information are taken from various places: the full name is read from /etc/passwd and the email address is taken from /etc/email-addresses, or, if there is no line corresponding to the sender, the address "user@hostname" is chosen.

If your mail client provides a "From: " line, Exim adds his information in a additional "Sender: " line, if the two lines differ. Anybody listed in the trusted_users option (in exim.conf) can avoid such behaviour by using the -f command-line switch of Exim. The line no_local_from_check in exim.conf tells Exim to omitting the check for everybody.

This is not a recipe for sending anonymous mails because in the header is enough information for the recipient to make some speculations about the real sender.


The UNIX-standard for mailboxes is the mbox format: every mail is appended to a single file. This can cause a long delay while checking mails with big mailboxes, because every line of a huge file must be scanned. When this file must be retrieved through NFS this would tax anyone's patience.

For this purpose Qmail introduced the Maildir format where a mailbox is a directory with the sub-directories cur, tmp and new and every mail is stored in a single file in the opportune directory. Moreover, mails can be marked as deleted by setting a flag rather than deleting it physically and can therefore be recovered easily. If your mail client supports the Maildir format, why not switch to?

In exim.conf must be added a new transport with the name address_directory. The Debian distribution already provides one like this:

    driver = appendfile
    prefix = ""
    suffix = ""

The prefix and suffix options tell Exim not to append lines to the message. this is useful in those case where mails are not forwarded but stored on hard disk. In the userforward: director must be inserted the following line

directory_transport = address_directory

Every user that wants to use the Maildir format must create a .forward file in his home directory. A minimal .forward looks like /home/username/Maildir/

Don't forget the trailing slash! Without slash the mails will be stored in a file named Maildir by using old mbox-format.

Maildir as default format

If Maildir has to be the default format, then the local_delivery-transport must be changed. The file=... statement must be replaced by a "directory=..." line and the option maildir_format must be used. An example might be:

    driver = appendfile
    group = mail
    mode = 0660
    mode_fail_narrower = false
    envelope_to_add = true
    return_path_add = true
    directory = /home/${local_part}/Maildir

If now a user has a line in his .forward-file defining a mailbox without trailing slash, Exim tries to store incoming mail in this Maildir, supposing it is a file - and will fail. Therefore it would be useful, to change all file_transports in file_transport = addres_directory. With this trick it is no more important if there is a trailing slash in the file name or not.


Exim can easily substitute programs like vacation or mailfilter, because it provides a powerful scripting language permitting tasks like storing mails in different mailboxes, forwarding mails, auto-responding or filtering a incoming mail through a external program. For every incoming mail Exim looks for a .forward file in the users home directory and if it exists, the mail is delivered according to its rules.

This file has a long tradition in UNIX, but it doesn't provide such a powerful and easy to understand scripting language. In order to enable Exim filtering rules, the file must begin with the string "# Exim filter". I've written a (untested!) example how a .forward file might look.

# Exim filter

save $home/Maildir/archiv/

if $h_from: matches "mad-hatter|march-hare|jabberwocky" or
    $h_x-mailing-list matches "^<debian-(.*)@lists\\\\.debian\\\\.org>"
    save $home/Maildir/wonderland/

if $h_subject: contains "sed-tutorium"
    deliver humpty-dumpty@wonderland.org

if $h_from: matches "tweedledum|tweedledee"
    pipe "flame | mail $sender_address -s \"Re: $h_subject\""

save $home/Maildir/spam/

The example stores every mail coming from the wonderland in the Maildir Maildir/wonderland and forwards those having a Subject containing "sed-tutorium" to a qualified Person. Mails with "tweedledum" or "tweedledee" in the "From: " field are processed through the asr program flame and sent back to the sender with the UNIX program mail. This mail and every mail not yet dealt, is stored in Maildir/spam.

Please read filter.txt for finding out how to test filters without risk of destroying incoming mails while testing a new .forward file.