How can I increase the number of Courier-IMAP connections for my Parallels Plesk Panel server?
Symptoms
Mail users see this error when trying to access their mailboxes:
ERROR:
Unable to connect to your IMAP server.
You may have exceeded the maximum number of connections to this server.
or this one:
Error reading from network: cause: connection closed by foreign host
Cause
By default, Parallels Plesk Panel and Courier-IMAP email server limit the number of inbound connections to prevent users from opening up too many concurrent sessions. 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 running an IMAP client that takes advantage of mailbox-caching.
Resolution
To remove this restriction and increase your allowed number of inbound connections, you can modify your IMAP configuration file located at /etc/courier-imap/imapd using the following Perl commands, which perform a "find and replace":
perl -p -i -e 's/^MAXDAEMONS=40/MAXDAEMONS=80/g' /etc/courier-imap/imapd
perl -p -i -e 's/^MAXPERIP=4/MAXPERIP=40/g' /etc/courier-imap/imapd
To apply the changes, restart the Courier-IMAP service using the following commands:
$PRODUCT_RC_D
/courier-imap stop
$PRODUCT_RC_D
/courier-imap start