For scalability, we are going to arrange for exim to deliver all local
mail in Maildir format. This creates a subdirectory called "Maildir" in
the user's home directory, which in turn contains three subdirectories:
new
, cur
and tmp
. Messages are
written into tmp
, moved to new
when delivery is
complete, and moved to cur
when read. Each message has a long
filename based on the hostname and the time of day.
Because each message is stored in a separate file, it is much faster for the pop3 daemon to start up every time a user connects; it does not need to read through the mbox file to count the messages in the mailbox. It also allows for safe delivery onto a shared (NFS) disk backend.
Suggestion: when creating new "E-mail only" accounts on your system, you probably don't want your users to actually be able to login to Unix using ssh or telnet. To disable this, create their accounts with a nonexistent shell.
# pw useradd username -m -s /nonexistent
Edit /usr/local/etc/exim/configure
, find the
local_delivery
transport and modify it as follows:
local_delivery: driver = appendfile directory = $home/Maildir maildir_format maildir_use_size_file delivery_date_add envelope_to_add return_path_add # group = mail # mode = 0660
Optionally you could add further parameters to this transport which let you impose quotas on your users, for example to limit all users to 10 megabytes of storage each:
maildir_tag = ,S=$message_size quota_size_regex = ,S=(\d+) quota = 10M quota_warn_threshold = 90%(Aside: this quota mechanism relies on users not meddling with the quota information which is stored within their maildir; in other words, users with shell access would be able to bypass their quota if they knew what they were doing)
Remember to HUP your exim daemon. Now test out your new configuration by delivering to some local account on your machine:
$ /usr/local/sbin/exim -bt localuser localuser@pcnn.e0.ws.afnog.org router = localuser, transport = local_delivery $ /usr/local/sbin/exim localuser Here is a test . $ cd /home/localuser/Maildir $ ls cur new tmp $ ls new 102078119.7969.pcnn.e0.ws.afnog.org,S=426 $ cat new/* Return-path: <root@pcnn.e0.ws.afnog.org> ... Here is a test
Note: once you have changed to Maildir delivery, you will find that if you have been using the "mail" command to read mail, it will no longer see new messages; that's because it will still be looking for it in /var/mail. Some MUAs can be configured to find new mail in your Maildir; however this one cannot.