Courier is one of the most known mail delivery agent. It only supports Maildir mailboxes and can be integrated with external databases (LDAP, MySQL, etc.).
You will find a complete description on how to setup a virtual Postfix + Courier mail system on PostfixCompleteVirtualMailSystemHowto. A simpler setup is described at PostfixAmavisNewClamAVSpamAssassin. To setup email in a generic way, look at the Ubuntu manual, for example at the the ubuntu servierguide/email (6.06).
In this howto, a basic Courier installation will be described: it will deliver mail to local existing users, mailbox will be situated in home directory. User accounts can be on an NFS file system (this is one of the advantages of Courier).
For installing courier, install the following packages: courier-imap courier-imap-ssl (see InstallingSoftware)
If you want pop3 support, also install courier-pop and courier-pop-ssl packages.
The configuration options are all located in /etc/courier/imapd for imap daemon and in /etc/courier/imapd-ssl for imap-ssl daemon. For a first installation, the default options perfectly match most of the needs. So no modification will be done.
Courier authenticates using PAM out of the box.
Basically, Maildir folders are located in the user home directory. That's a good idea to create Maildir for future users:
sudo maildirmake /etc/skel/Maildir sudo maildirmake /etc/skel/Maildir/.Drafts sudo maildirmake /etc/skel/Maildir/.Sent sudo maildirmake /etc/skel/Maildir/.Trash sudo maildirmake /etc/skel/Maildir/.Templates
Then, for an existing user:
sudo cp -r /etc/skel/Maildir /home/myuser/ sudo chown -R myuser:usergroup /home/myuser/Maildir sudo chmod -R 700 /home/myuser/Maildir
You can easily test that your recent installation is working:
telnet localhost imap Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information. 01 "login" "user password" 01 OK LOGIN Ok. 02 select "Inbox" * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent) * OK [PERMANENTFLAGS (\* \Draft \Answered \Flagged \Deleted \Seen)] Limited * 1 EXISTS * 0 RECENT * OK [UIDVALIDITY 1346506955] Ok * OK [MYRIGHTS "acdilrsw"] ACL 02 OK [READ-WRITE] Ok 03 logout * BYE Courier-IMAP server shutting down 03 OK LOGOUT completed
Where user and password are local accounts with a Maildir directory. If it does not work you will get an error message, and do not forget to check /var/log/mail.log. "01" is necessary at the beginning of the line as part of the imap protocol, although any sequence of numbers or letters will do.
Administration & Maintainance
Administering a Courier IMAP/POP mail server does not really require some specific administration tasks. For each user connecting correspond a process of the system (in fact a process per Maildir directory open). For backup, only backing up user accounts (as usual ;-)) is necessary.