Using IMAP

IMAP stands for Interactive Mail Access Protocol. It is another method of communicating with an email server.
Generally, the mail is held on the server, and not on the client. This makes it ideal for organizations with a central administrative function, as it eases backups, and also allows users to change the client computers that they work at – as long as the email client is installed, they can access their email from any computer on the network, or even from home or another office.

In contrast to POP3, IMAP allows users to create folders on the server, so that related emails can be stored together.

Configuring Courier for IMAP

After Courier-IMAP has been installed, either from package or from source as described above, it needs to be configured before it can be used.

The configuration files are located in /usr/lib/courier-imap/etc/courier-imap/, if courier was built from source. If using a packaged distribution, they may be located in /etc/courier-imap. The file imapd contains the settings for the IMAP server.

If you are using a packaged distribution of Courier, then the configuration files can be found with this command:


Once the file has been located, it can be modified as appropriate. Here are the main configuration directives: Here is a sample imapd configuration file:

Setting Description
PIDFILE The imapd daemon keeps track of the process ID that it uses. Specify a valid path and a name which suggests the use of the file. Typically, this might be /var/run/
MAXDAEMONS This specifies the maximum number of imapd process that can run at one time. The number of users that can connect at one time is limited by this number. A number higher than the expected number of users may be wasteful, but users attemptingto connect are also included in this number. Set this to a number around the maximum that may connect at one time, or a little higher.
AUTHMODULES This specifies the authentication method to be used. If the courier authentication daemon is used, as with Courier-IMAP v4.0 and later, then set this to “authdaemon?
POP3AUTH If the courier authentication daemon is used, set this to blank, otherwise set it to indicate the type of login authentication performed. For versions prior to 4.0, this should probably be set to “LOGIN?.
PORT This specifies the port that the daemon listens on. The standard port is 143, and a different one should only be chosen if all client software is configured to use the non-standard port.
ADDRESS This specifies the IP address to listen on. If the machine has multiple network interfaces, then Courier can be configured to listen only on one of the addresses. A value of 0 indicates that all network interfaces should be used.
Setting Description
TCPDOPTS These are options to be used. Typical ones used include -nodnslookup, which prevents the pop3 daemon from attempting to resolve the name of each connection, and -noidentlookup prevents it from attempting an ident query for the incoming connection. Specifying both of these settings can decrease the time taken to authenticate a user connection.
MAILDIRPATH This is the path to a typical user's maildir. Specify the appropriate value for your system, for example “.maildir?
MAXPERIP This specifies the maximum number of connections from each IP address. A low number prevents malicious acts such as denial-of-service attacks, where an attempt is made to use up all the connections on the mail server.
IMAP_CAPABILITY This describes the IMAP capabilities that the server reports to clients. It should probably be left on the default setting.
IMAP_EMPTYTRASH This specifies how long email messages should be kept in certain folders for. Messages older than the date specified are automatically deleted, either when the user logs in or logs out. This can be used to automatically delete email from the trash folder after a certain period. This works for all folders, so emails in the "Sent items" folder could be deleted after a longer period has expired. For example, IMAP_EMPTYTRASH=Trash:7,Sent:30 specifies that emails in the