Plesk FUCK: Raising Courier-IMAP connections for server on Plesk.

Instructions

Plesk comes configured with both a limit of connections per IP address and an overall limit of Courier-IMAP connections. Modern IMAP clients such as Mozilla Thunderbird use mailbox caching to open up multiple connections to increase performance. In the case of Thunderbird, it opens up 5 connections by default which is already 1 connection more than Courier-IMAP’s default restriction. Add another few computers behind a firewall and, depending on your IMAP configuration, those additional may not be able to connect at all since a single Thunderbird client is already utilizing all connections.

To increase this restriction you can modify your IMAP configuration file located at /etc/courier-imap/imapd using the following Perl commands which perform a “find and replace”:

[root@odesk courier-imap]# perl -p -i'.odesk' -e 's/^MAXDAEMONS=40/MAXDAEMONS=100/g' /etc/courier-imap/imapd
[root@odesk courier-imap]# perl -n -e 'print if /MAXDAEMONS=/ ' /etc/courier-imap/imapd
MAXDAEMONS=100
 
[root@odesk courier-imap]# perl -p -i'.odesk.1' -e 's/^MAXPERIP=4/MAXPERIP=32/g' /etc/courier-imap/imapd
[root@odesk courier-imap]# perl -n -e 'print if /MAXPERIP=/' /etc/courier-imap/imapd
MAXPERIP=32 

Then to complete the changes restart the courier-IMAP service using the following commands:

[root@odesk courier-imap]# service courier-imapd restart
Stopping Courier IMAP server:                              [  OK  ]
Starting Courier IMAP server:                              [  OK  ]

The above commands change MAXDAEMONS from 40 to 100 and MAXPERIP from 4 to 32, thus allowing for many machines behind a firewall to connect to multiple accounts on the email server with mailbox caching enabled.

But even those numbers may be too low for a corporate server that services an entire company. Tweak those numbers based on your employee base; if 50 employees are connecting to the email server from behind the same firewall then MAXPERIP could need to go as high as 250 (50 employees x 5 cached mailbox connections). Add email clients of people working from home and MAXDAEMONS could go as high as 300 or 400!

Obviously, the connection limits are to prevent the Courier-IMAP server from using too much memory and/or CPU resources on the machine. Tweak the numbers based on the DV service that you have and it’s available memory resources. If you are still receiving this error after making these changes, you might want to consider other ways to reduce usage or possibly upgrading your service.

Thanks some guys in Internet

Scroll to top