Add more Courier-IMAP connections under Plesk

By default, 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. Unfortunately, this artificially-low 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.

Plesk comes configured with a limit of 4 connections per IP address and a limit of 40 connections total. 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 family or corporate computers behind a firewall and those additional users won’t be able to connect at all since a single Thunderbird client is already utilizing all 4 connections.

To increase this restriction, modify the /etc/courier-imap/imapd configuration file and change MAXDAEMONS and MAXPERIP to a more sane number. In the case of my configuration, I changed MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40. This allows all the machines behind my home firewall to connect to multiple accounts on the e-mail server with mailbox caching enabled.

But even those numbers may be too low for a corporate colocated server that services an entire company. Tweak those numbers based on your employee base; if 50 employees are connecting to the e-mail server from behind the same firewall then MAXPERIP could need to go as high as 250 (50 employees times 5 cached mailbox connections). Add e-mail 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 many memory and CPU resources on the machine. Tweak the numbers based on the memory footprint of each daemon process and how much memory you have.

40 thoughts on “Add more Courier-IMAP connections under Plesk”

  1. I was not aware of Plesk’s oddly low default settings. I mean until I started getting errors in Thunderbird about connection caching and then googled this post 😉 Thanks for the great post!


  2. Thanks a lot for the tip! Apple has severe problems with just 4 connections, so this saved my day!

  3. It also makes sense to check the authdaemonrc options. Too few daemons can be another bottleneck–but of course, when configuring settings, tweak and balance for the particular system’s resources and other services.

  4. Thanks a ton for the info! I found it pretty strange that the settings weren’t working for me at work, since relatively few people are using IMAP here. Things make a lot more sense after looking at the configuration file that’s set so low.

  5. What a great post – thanks. I just got a (dv) hosting account from Media Temple and was wondering why Apple Mail was throwing lots of errors. I think for this to work though I had to restart the courier server with:
    /etc/init.d/courier-imap restart


  6. Thank you so much for figuring this out. I want to love Plesk, but I keep bumping into these kind of stupid issues with their software.

  7. great tip. Works. God knows why tech support at theplanet did not tell me this. They said to add a gig of ram, which surprise surprise did not work, but costs $20 a month extra.

  8. Also wasn’t aware of the low default settings. The above poster shows how little calldesks ever know. They tend to just dish out advice from sucking their thumb, but they never do their research. If they (at least) Googled the problem they probably would have found this post or details about the default settings. Rather, they just opted for the easy option. Quite typical of calldesks.

  9. Thank you very much for this tip. I was getting nervous while was hanging.

    Thanks so much

  10. Hope this does the trick. Errors from my Plesk IMAP account have been annoying me forever. Thanks!

  11. WOW!! That is all I can say.
    I have been troubleshooting IMAP problems for days and wondered why this only happened on a client that had two IPHONES, two laptops and three accounts.. Do the math and you can see what this has been hell after migrating from CPANEL to Plesk. Thanks!!!

  12. I have the same problem with my ISP that using Plesk, I ask him to set more connections, now he said that he can’t set more than this but I have some problem already.
    Can I limit the connections from my IMAP client, that is Mail on Mac OS X 10.6?

  13. Our Gambling server has only 2 GB of memory. We have around 100 websites and every website has her own email… and some webs have many email so I changed it to 200 but i am worried about the increase of resources. I experience many problems with thunderbird, i changed each account to 1 cached connection but the problem continued.

    Thanks for the post, I will test and review here in some days… when tested the new config.

  14. I’ve just solved a similar issue, only with regards to POP mail.

    I have a dedicated server running Plesk 9.5 and when I upgraded to iLife 11 and Snow Leopard this error appeared. I could quickly click “get mail” and I’d get all my mail, but only 3-4 of my 9 mail accounts would connect. Theo others would have the error:

    “The server error encountered was: The attempt to read data from the server…”

    I found solutions for those using IMAP mail here in this thread:

    modify the /etc/courier-imap/imapd configuration file and change MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40. This allows all the machines behind my home firewall to connect to multiple accounts on the e-mail server with mailbox caching enabled.

    I’d made this change on my server but it didn’t seem to have any effect. It dawned on me that I’m using POP, not IMAP. So I found in /etc/courier-imap/pop3d the same settings. I changed the MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40 and voila, all my connections concurrently worked.

    This has taken me more than two days to fix and I hope posting this helps someone else with the same issue.

  15. I am a graphic designers and I’ve just got a virtual server using plesk. I’m not an IT expert and to be honest, this solution means absolutely nothing to me. I’ve tried googling to no avail.

    Can someone please tell me, assuming no prior knowledge, step by step how to modify the /etc/courier-imap/imapd configuration file and change MAXDAEMONS from 40 to 80 and MAXPERIP from 4 to 40.

    Thank you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.