Yesterday I updated a gentoo box and after that no more SSL and TLS connections with courier-imap were possible.
The log had some entries of the type
imapd-ssl: couriertls: /etc/ssl/certs/e1213163.0: No such file or directory
The file mentioned linked to
21 Apr 15 14:47 e1213163.0 -> signet_rootca_pem.pem
The CA cert of signet was removed for some reason, but the symlink wasn't. This is a hard error for courier for whatever reason. It stopped working without a good error message.
To fix this just run
find /etc/ssl/certs -type l ! -xtype f ! -xtype d -ok rm -f {} \;
This will remove all dead symlinks in /etc/ssl/certs