Adding the Courier IMAP server to your system (Debian, Ubuntu)

Courier offers IMAP services for your system.

Prequisite: PostFix mailserver package

Prequisite: Maildir style mailboxes see here

Add the Courier package for IMAP support

sudo apt-get install courier-imap

 Courier will install a self signed certificate at the location /etc/courier/imapd.pem, which can be replaced with a production grade certificate later.

Add your local domains to postfix

Check domain settings with sudo postconf mydestionation (debian: /usr/sbin/postconf mydestionation)
Correct domain settings with sudo postconf -e mydestination
Check/correct local networks: mynetworks
Instruct postfix to receive mail on all interface: sudo postconf -e “inet_interfaces = all”

IMAP Authentication is provided by de auth daemon, start it after installation:

sudo service courier-authdaemon start
sudo systemctl enable courier-authdaemon
sudo systemctl restart postfix

Add mail-enabled users

useradd b.keut -d /home/b.keut -m -s /bin/bash
passwd b.keut

Send a testmail to create the Maildir directories, and check if all looks allright:

apt install mailutils
mail b.keut@example.com (creates an interactive message, end the body with ctrl-d)

You can create additional aliases for your mail users through the file /etc/aliases. Format: alias: realuser  (aka: info: someuser)

Update with the newaliases command