Codingdomain.com

Automatic mail processing

IMAP server setup

After installing the required software, it's time to configure the processing chain. Just to be on the safe side, try to configure the IMAP server first. Once this works, the download-chain can be configured.

Maildir folders

First prepare the storage folder; the maildir where all messages are downloaded to.

Create the maildir:
cd                       # change to home folder
maildirmake .maildir      # create the maildir
ln -s .maildir ~/Maildir   # create a link for compatibility
cd -                     # change to the previous folder

All subfolders can be created from your e-mail client, once the setup is complete.

Courier IMAP Server

To use Courier IMAP, you need to change the following settings:

/etc/courier-imap/authdaemonrc
authmodulelist="authpam" # use "authshadow" for systems without PAM
daemons=1                # increase this if you're not the only user
/etc/courier-imap/imap
IMAP_CHECK_ALL_FOLDERS=1
IMAPDSTART=yes           # Very important!!
MAILDIR=.maildir/
MAILDIRPATH=.maildir/
/etc/courier-imap/imapd-ssl
IMAPDSTARTTLS=YES        # Same here, also very important
MAILDIRPATH=.maildir/

If you access the IMAP server from your own system only, you can increase the security by binding the IMAP servers to the 127.0.0.1 address. This makes the service invisible from any other network interface, even if the firewall is disabled. This setting can be set with the ADDRESS and SSLADDRESS option of both configuration files.

Now, try to start the Courier IMAP Server. Unfortunately this differs in each distribution. You can start the regular IMAP server, or start the SSL/TLS enabled IMAPS server. 'IMAPS' is just normal IMAP over a secure encrypted connection (SSL). It's recommended to use the SSL option when possible.

Try one of these:

Starting the IMAP server:
/etc/init.d/courier-imapd-ssl start       # Standard init.d method
/usr/lib/courier-imap/imapd-ssl.rc start  # Courier's own script

In Gentoo Linux, the service won't start until the configuration file /etc/courier-imap/authdeamond.conf is modified. The authorisation module needs to be set to authdaemond.plain. This module compares all passwords with the passwords from the local Linux user account passwords. It's possible to use a different module to validate the login data with a MySQL database, or LDAP directory for instance.

The IMAP server should be running, and this can be tested with the ps auxf and netstat -lnpA inet commands. To start the server automatically at boot, consult the documentation of your distibution.

Next part