How to increase the number of Courier-IMAP connections on Centos, Linux

This article applies to you if you are seeing this message when accessing your email:

ERROR:
Unable to connect to your IMAP server.
You may have exceeded the maximum number of connections to this server.

Reason:

UNIX-based servers running Plesk and the Courier-IMAP e-mail server drastically limit the number of inbound connections to prevent users from opening up too many concurrent sessions, by default. Unfortunately, this restriction can impact legitimate users who have multiple computers connecting to the Courier-IMAP server from behind a firewall or a single computer that runs an IMAP client that takes advantage of mailbox caching. (If you are interested reading more about connection restriction please go here)

Solution:

If you have SSH access to your server using console tool like putty, do the following:

[root@host /]# perl -p -i -e 's/^MAXDAEMONS=40/MAXDAEMONS=80/g' /etc/courier-imap/imapd
[root@host /]# perl -p -i -e 's/^MAXPERIP=4/MAXPERIP=40/g' /etc/courier-imap/imapd
[root@host /]# /etc/init.d/courier-imap restart

Where
#MAXDAEMONS – Maximum number of IMAP servers started were increased from 40 to 80
#MAXPERIP – Maximum number of connections to accept from the same IP address were increased from 4 to 40

And server restarted using command.

Leave a Reply