• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How I got Courier IMAP to work on Debian running Plesk after lots of frustration

R

robin24

Guest
Dear Plesk users, server admins, forum guests and anyone else I forgot to mention,
I'd like to tell you all about an adventure I've had to go through up until today, the adventure of setting up the IMAP Mail service with Plesk and then actually being able to use it properly. Over all, it's all about some pretty limiting default values in a certain config file set by the Plesk installer, cupeled with the user being unable to see this from within the panel and to easily set more reasonable values.
But well, first things first. So, I installed Plesk 10.4.4 on a fresh installation of Debian Squeeze. Everything went through just fine, and I was able to access the Plesk Panel within minutes. All of the configuration went through just fine as well, up until when I got to the Mail server configuration (Postfix as the MTA and Courier for POP3 / IMAP access). Again, the actual configuration through Plesk went through just fine, and after adjusting the server-wide Mail settings and creating a Mailbox, I was pretty much set to go… Almost. After setting up the new EMail account in my Mail client (Apple Mail), I kept getting errors stating that Mail had been unable to establish a connection with the IMAP server. After restarting both the client and some server components a cowple times, it eventually worked, though not always. I wasn't happy with this situation at all, since it was far from being stable and reliable. Also, I was annoyed that I'd been unable to actually track down the issue - web Mail worked, connecting to IMAP via Telnet worked, there weren't any errors recorded in the logs. Also, I tried to get some help here in this forum and from my Plesk reseller, but with no luck at all. So then, at some point, I created a second EMail address and mailbox for another purpose. Again, I set up this account in Apple Mail. At this point, things were totally getting out of control. I now was unable to connect to the server at all, with the Mail client giving me errors saying that it was unable to connect to either of the two IMAP accounts. Thus, by setting up the second account, I had somehow locked myself out of the first account. Again, connecting to either of the 2 via Telnet worked without any problem, and I was really confused - no helpful entries in the logs then either. So then, at some point and after some major frustration, I came up with an idea. My idea was that, for some reason, maybe Courier would only accept a very low number of connections. I know that, in order to do mailbox caching and stuff, usual Mail clients establish around 5 connections to an IMAP server at a time. Since Plesk is often meant to run on huge servers with many types of clients, I had assumed that configuration parameters would be appropriately set to handle lots of traffic. However, after some looking around, I found the file /etc/courier-imap/imapd… And in there, I found this:

MAXDAEMONS=8
MAXPERIP=4

As can be seen here, the connection limit (MAXPERIP) value is even too low for even just one IMAP user running a Mail client that does mailbox caching. Thus, this is definitely *not* suitable for production use as long as you offer IMAP to end users or even just use it for yourself. I increased both MAXDAEMONS and MAXPERIP values, and now it's working just fine. So, a really easy solution for a really big and frustrating issue. Only thing is, I'm a bit annoyed at Parallels for A) setting such ridiculous values and B) not allowing the server admin to adjust this from within the panel. After all, I decided to go for Plesk because I want to do administrative tasks using a GUI rather than a shell, and so that I can pass along some of these tasks even to people who don't even know how to use a shell. Also, I don't like changing config files with this setup, as I'm afraid this could break some administrative Plesk features. However, as things are now, I can't really be sure if there are any other config problems like that, maybe even related to other services. Also, it's hard to decide how to tackle this issue. Am I supposed to go through every config file now to make sure there are no other such ridiculously small connection limits or anything like that?
I seriously hope you guys over at Parallels will address this issue, as it is so damn frustrating to track down for someone running a Mail server for the very first time. Yes, the solution turned out to be pretty trivial at the end, but I had to do so much tedious and unnecessary guesswork before I actually got to the issue. Please, can you just make this configurable from within the Panel, or at least increase the default values?
Thanks so much!!! :)
Robin
 
thank you so much for this, i have just had this issue and if it wasnt for your post who knows how long it would of taken
 
Yes, I wasted many hours Googling for an answer as to why Thunderbird was giving an "Unable to connect to IMAP server etc" warning and also could not believe the default settings were so small for an ISP panel system when I finally found an answer. I've got 4 IMAP accounts on this new Plesk server and I'm still getting this error in Thunderbird even though my MAXPERIP=400 and I've lowered the TB IMAP settings to 2 connections per account. I run courier-imap on a couple of non-Plesk servers and never struck this problem before so, being a Plesk novice, I am wondering if /etc/courier-imap/imapd is actually the right config used? According to dpkg -L psa-courier-imap it is indeed the right config file and because I use SSL on port 993 I've also added MAXPERIP=400 to /etc/courier-imap/imapd-ssl as well, but I still get the Thunderbird error.

Is it possible that there are not enough AUTHMODULES="authpsa" daemons running?

I have 12 of these running atm so most likely this is not the problem but I can't figure out why TB gives this error when using psa-courier-imap on a Plesk server but not on my other non-Plesk servers.

/usr/bin/couriertls -server -tcpd /usr/sbin/imaplogin \
/usr/lib/courier-imap/authlib/authpsa /usr/bin/imapd Maildir

The imapd invocation looks right to me...

/usr/lib/courier-imap/couriertcpd -address=0 -stderrlogger=/usr/sbin/courierlogger \
-stderrloggername=imapd-ssl -maxprocs=4000 -maxperip=400 \
-pid=/var/run/imapd-ssl.pid -nodnslookup -noidentlookup 993 /usr/bin/couriertls \
-server -tcpd /usr/sbin/imaplogin /usr/lib/courier-imap/authlib/authpsa /usr/bin/imapd Maildir
 
Hi Mconstable,
sorry to hear that this issue also wasted so much of your time, and that you're still having trouble with the Courier IMAP configuration.
Personally, I can only confirm that it looks like you've modified the correct files and all should be fine, but to be honest you can never be sure about what Plesk is doing, in my opinion. Thus, I've decided to completely turn my back on Plesk a couple of weeks ago, revoked my Plesk license and re-formatted the server. I'm now happy to say I am running Debian Squeeze and the free, open-source Froxlor control panel, which can be found at http://www.froxlor.org/

Yes, setting up Froxlor requires some more work creating config files and setting up stuff before it all works. However, the instructions it provides you with are completely straightforward and you actually get to work with each individual service to set everything up. However, once everything's done, you should end up with a stable, functional system that runs and does its job just fine. Best of all, with this config you actually have a much, much better understanding of how each service works, so if you want to change something, or if you run into any issues with a service you should know where to look for the appropriate configuration files. Also, I do think Froxlor has a much, much better interface than Plesk - it doesn't have all the functionality that Plesk offers, yes, but it comes with everything you need to get a flexible, stable system - and if you need anything extra, well, you're free to add it in! Also, like I said before, it's an open source project, so if you want you could always make changes to the underlying code - and also, the Froxlor community is much stronger and much more responsive than the Plesk community is, no offence. Well, feel free to check it out and get back to me with any questions!!!
Robin
 
I personally swore I'd never use proprietary software exactly to avoid issues with unknown binary blobs, so I can fix things myself and contribute those fixes directly to back to the upstream project. I had a look at Froxlor but I really dislike Smarty templates and the billing system was removed, which I need the most. I actually started hacking on it's predecessor, sysCP, but time ran out and I had to make a call on some kind of web based ISP management system that I could deploy quickly. The initial Plesk install went well, and at first I was super excited, but I quickly found that trying to get it to do what I needed was overwhelmingly complicated and even though I've read half the docs they really do not help a beginner. The knowledge base is handy once one knows the basics and needs some help with specific issues but neither they or the docs seem to be able to guide a first time user from introductory video tutorial stage through to a working installation. Not in my case anyway. I'm locked into Debian as well so using something like cPanel and WHMCS is not possible. I have paid for one $75 voice support session and I can't even begin to say what I think about that experience. If I ever come across an open source project on Github that has decent billing then I'll migrate in a heartbeat.

Anyway, thanks for the suggestion, and regarding this issue, what gets me is that I use courier-imap along with courier-mta on a few other servers and have never ran into this problem with Thunderbird before.
 
Thanks for this. I just found it today after various tablets, phones and PCs here in the office stopped contacting the new server.

For the record, my original settings were:

MAXDAEMONS=40
MAXPERIP=4

Still fairly useless limits for a server capable to hosting multiple clients and reseller accounts. I increased those significantly. I hope Parallels take notice of this thread and consider using sensible values or at least providing a GUI to see and set them.

Regarding message #3, did you restart the imap server?:

/etc/init.d/courier-imap restart

Worked for me. :)

Brian
 
Back
Top