Synopsis

Courier-IMAP is a fast, scalable, enterprise IMAP server that uses Maildirs. Many E-mail service providers use Courier-IMAP to easy handle hundreds of thousands of mail accounts. With the built-in IMAP and POP3 aggregation proxy in Courier-IMAP, the only practical limit to Courier's horizontal scalability is available LAN bandwidth...

Installation

Requirements: Courier-Authlib (as of Courier-IMAP version 4.0)

Compile Courier-Authlib with the following compile time options. Be sure to enable the database you will be using. Here we use PostgreSQL:

 --with-authpam
 --with-db=db
 --without-authmysql
 --with-authpgsql

Compile Courier-IMAP with the following compile time options:

 ./configure
  --with-db=db
  --enable-unicode
  --enable-workarounds-for-imap-client-bugs

Gentoo users

If Courier-Authlib is not already installed, Portage will install it for you.

 $ USE="berkdb crypt mysql pam postgres" emerge net-mail/courier-authlib
 $ USE="berkdb nls" emerge net-mail/courier-imap

Post installation

Files to be modified: * /etc/courier/authlib/authmysqlrc * /etc/courier/authlib/authdaemonrc * /etc/courier-imap/imapd * /etc/courier-imap/quotawarnmsg

authmysqlrc

Some administrators have claimed that uncommenting both MYSQL_CRYPT_PWFIELD and MYSQL_CLEAR_PWFIELD causing login issues. Courier-Authlib documentation states that it's safe to leave both uncommented but if you run into issues, uncomment the format you're NOT using. Additionally, [[vMail.Admin]] requires that both the CRYPT and CLEAR password fields be the same field.

Additionally, do not put a password as the constant for MYSQL_CRYPT_PWFIELD nor MYSQL_CLEAR_PWFIELD. The word "password" there literally defines the name of the database cell, which, in this case, is "password".

{{Box File|/etc/courier/authlib/authmysqlrc|

MYSQL_SERVER            localhost
MYSQL_USERNAME          postfix
MYSQL_PASSWORD          ***secret***
MYSQL_DATABASE          postoffice
MYSQL_USER_TABLE        mailbox

MYSQL_CRYPT_PWFIELD     password
MYSQL_CLEAR_PWFIELD     password

DEFAULT_DOMAIN          domain.tld
MYSQL_UID_FIELD         uid
MYSQL_GID_FIELD         gid
MYSQL_LOGIN_FIELD       pobox
MYSQL_HOME_FIELD        homedir
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir
MYSQL_QUOTA_FIELD       quota
MYSQL_WHERE_CLAUSE      active = '1'

authdaemonrc

{{Box File|/etc/courier/authlib/authdaemonrc|

authmodulelist="authmysql"
authmodulelistorig="authmysql authpam"
daemons=5
authdaemonvar=/var/lib/courier/authdaemon

imapd

Leaving this file at default is perfectly fine. Either way, the following are some values you should consider: {{Box File|/etc/courier-imap/imapd|

MAXDAEMONS=40

# Set MAXPERIP to something sensible
# This ensures that you can use things like email checkers,
# mail clients, etc simutaneously.
MAXPERIP=10

TCPDOPTS="-nodnslookup -noidentlookup"
IMAP_EMPTYTRASH=Trash:7,Sent:30

# Defaults to NO, so if you don't set this, well,
# the server will most likely not start :-)
IMAPDSTART=YES

quotawarnmsg

If you plan to implement quotas, be sure to create /etc/courier-imap/quotawarnmsg. An example is provided in the same directory that you can move and mofidy.

Follow up

Start Courier-Authlib and Courier-IMAP/POP3 and don't forget to add courier services to your default run level so that they will start when your system is rebooted. Only start services you plan on using.

Gentoo users

 $ /etc/init.d/courier-authlib start
 $ /etc/init.d/courier-imapd start
 $ /etc/init.d/courier-pop3d start
 $ rc-update -a courier-authlib default
 $ rc-update -a courier-imapd default
 $ rc-update -a courier-pop3d default