Cannot connect to mail server even when all the settings are correct Print

  • 0

Problem Description

Assuming all settings are 100% correct, this problem can happen in one of two situations:

  1. The server has a large number of mail users on it that are exceeding the default IMAP connection limit (typically around 70 or 80)
  2. You’re connecting using more than one device on the same network (behind the same IP)

The latter is the most common problem, but (1) can happen here and there as well.

Problem Resolution

The solution is to configure courier-imap to allow more simultaneous connections overall and/or more connections per IP. It’s probably best to do both at the same time so you don’t have to keep fiddling with the settings, even if you only need to change one of them at this time to resolve the issue at hand.

Edit /etc/courier-imap/imapd on the server in question. Look for the options MAXDAEMONS and MAXPERIP and set them to higher values than what is shown. For a server with about 100 domains, the following values seem to work well:

MAXDAEMONS=200
MAXPERIP=50

However, you can tweak these as necessary to ensure you don’t get any connection limitation issues on the server.

Be sure to restart courier-imap once done, otherwise the settings will not take effect:

/sbin/service
courier-imapd restart
/sbin/service
courier-imaps restart

The first does standard IMAP and the second will restart secure IMAP services. If you’re on an older install of CentOS or Plesk, they may both be in one command:

/sbin/service
courier-imap restart

Was this answer helpful?

← Back