User Tools

Site Tools



1. Install Courier

 apt-get install courier-imap
 This will pull down all relevant packages
 Chose defaults when installing. No to web-based administration. Ok to default cert. (see more later)

2. Main Config is naturly enough in /etc/courier Nothing is chanced in Courier Configs 3. To get postfix handing off to Courier:

 Config Postfix (done using this page:
 Comment out #mailbox_command = /user/bin/...
 Include or uncomment home_mailbox = Maildir/

4. Step 3 should automatically make a Maildir in /home/user when mail is recieved

 If you want to make the maildir manually, because a maildir is required for IMAP Login:
 Done using this website:
 maildirmake Maildir
 This can be done for defauly users in the skeleton account /etc/skel/

5. IMAP login and receiving emails should work ok using telnet (see postfix_smtp for info on sending email with telnet)

6. Fix for courier. So thunderbird gave me the error: “Alert from account: Filesystem notification initialization error – contact your mail administrator (check for configuration errors with the FAM/Gamin library). apt-get install gamin Ref: 7. Now there does seem to be a load in PROCMAIL that I'm not using. Rules can be made as to what folder to sort incoming email. (Some basics are at: Actually I am mixing up procmail with maildir!! POSTFIX → PROCMAIL (not even sure!) → MAILDIR → COURIER

Install and Config for Procmail

 apt-get install procmail
 vi /etc/postfix/
 #add the line:
 mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir
restart postfix and test.

Quick config for procmail

 vi /home/$USER/.procmailrc
 #Start of Procmailrc script.
 :0 c

This above procmail recipe creates a procmail log for the user. It also forwards a copy of all email to More procmail rules at

===== Update Cert ===== Even though I'm sure its not the best practice, I copy the newly updated apache.pem cert and use it for courier-ssl. cp /etc/apache2/ssl/apache2.pem /etc/courier/imapd.pem /etc/init.d/courier-imap-ssl restart

Secure IMAPs

Mandate secure imapds

vi /etc/courier/imapd-ssl

On installing courier via apt-get it creates a test ssl cert. However its not self-signed. To create a self-signed cert:

cd /root/
openssl req -x509 -newkey rsa:1024 -keyout  imapd.pem -out imapd.pem -days 9999 -nodes
#rename /etc/courier/imapd.pem to -old
#move from /root into /etc/courier
chown courier /etc/courier/imapd.pem
chmod 600 /etc/courier/imapd.pem

/etc/init.d/postfix restart
/etc/init.d/courier-imap-ssl restart


Testing imaps via a client PC and problems

Testing with thunderbird did not go to plan. I normally use thunderbird portable to login and test. It hung and did not create the account. In /var/log/, it showed: imapd-ssl: ip=[::ffff:], Certificate is bad

After a lot of testing, it turned out it was nothing to do with imapd.pem, but a problem with thunderbird and self-signed certs. Thunderbird did not prompt to allow exception.

Solution 1 - Use Mailbird - it prompted to allow and store exception.

Solution 2 - Fix for Thunderbird for imaps self-signed certs:

go to Options > Composition > Addressing
Check Directory server and Edit Directories > Add new
set name to: 'fakeLdapDirectory'
specify server address:
Base DN: cn=base
Check 'Use secure connection(SSL)'
set port: 993
Bind DN: cn=user,cn=base
Base and Bind DN does not need to exist, cn=user,cn=base will doe the trick. Click OK, close Edit connections dialog.
Select directory server in the list
Go to Inbox Tab > Address Book
Select fakeLdapDirectory in the list and type something into the search input on top right. If asked for password type anything e.g. 'letMeIn'
You should get 'confirm certificate exception dialog', confirm it, now mail messages should be downloadable


Final Config

For final additions to postfix with courier and procmail, please see: debian_bullseye_config

courier_imaps_server_-_maildir.txt · Last modified: 2022/07/20 22:48 by admin