Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A potential fix for Mail.app and IMAP problems Apps
I was having issues with Mail.app (10.3) and synchronizing mailboxes. As many people have suggested, I turned off "automatically synchronize" in preferences, but I still was unable to manually synchronize my mailboxes. I could log in and get my mail, but synchronize would fail.

My mail server is courier imap on linux. The synchronization would continue for a point and then suddenly stop, with the account take offline due to an error. The error message was NSStreamSocketSSLErrorDomain -9806, which suggests an SSL error.

But the real problem is that Mail.app is making a lot of connections. The default limit on Courier is 4. For me, just logging in makes three connections. When Mail.app attempts to create a fifth connection, Courier slams the door and Mail.app gets offended. To fix this issue on the server, find Courier's configuration file and modify MAXPERIP. Here is my example:

# grep MAXPERIP= imapd
MAXPERIP=15
My original value was 4. The exercise of finding your Courier etc/imapd file is left to the reader. My theory is that Mail.app wants to first negotiate SSL, and then be told that it cannot connect - but Courier drops the connection before the SSL negotiation. If this is the case, this issue will not manifest itself on unencrypted connections, and may not manifest itself on more "polite" IMAP servers which allow the SSL handshake to happen before rejecting the client.

It also would be great if somebody could figure out how to tame Mail.app. Not everybody has administrator access to their mail server. The plist file has a "CacheOveraggressively" key which sounds promising - but is only equivalent to the "Automatically Synchronize" on the advanced account pane - which doesn't help if you can't even manual sync your mailboxes!

    •    
  • Currently 2.60 / 5
  You rated: 1 / 5 (5 votes cast)
 
[31,333 views]  

A potential fix for Mail.app and IMAP problems | 15 comments | Create New Account
Click here to return to the 'A potential fix for Mail.app and IMAP problems' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A potential fix for Mail.app and IMAP problems
Authored by: eno on Dec 08, '03 12:19:11PM

This is not really a Mac OS X hint at all... But in any case, I had the same problem.

I changed the setting in the Courier imapd file on my FreeBSD server to 16, and Mail's behaviour calmed down somewhat.

As far as I can tell, Mail not only opens these connections en masse, but it maintains them in the open state for as long as it's running... I think this is something that Apple should fix... firstly, make fewer connections per account; and secondly, if there are multiple mail accounts to be checked or synchronised, at least have the option to do them one at a time; and thirdly, do not leave the connection hanging open while Mail app is running.



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: Beernd on Dec 08, '03 02:47:23PM

No, that's a feature, not a bug! IMAP has the nice feature of unsollicitedly giving notice to a client when something changes, like when new mail arrives, but for that the connection needs to stay open. That way one doesn't need to ask the server every n minutes if there's new mail.

---
"Perhaps nothing is quite true, and not even that!"
Multatuli, Ideen 1



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: sitharus on Dec 08, '03 03:44:56PM

Not for mail. This is not part of the IMAP spec, it's an extension called IDLE, it only works if the client supports it. From analysing my logs, mail does not support it.

---
--sitharus



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: ab on Dec 08, '03 03:47:12PM

Not from firsthand experience, but I've heard that Outlook also does this to IMAP servers in IMAP mode. Could the Exchange compaible features added to Mail.app have made Mail.app behave more like Outlook? Their synchronization is really designed for a LAN environment and does not seem to work with a dialup connection at all let alone servers with connection limits.

---
-ab



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: rabblerouser on Dec 08, '03 09:51:19PM
I've never had this issue, and the way I access my imap server may be the reason why.

At home, I've got all my mail going into a linux server running courier-imap. When home, I access the imap server over the LAN and all is happy.

When away from home, I use ssh to tunnel my imap traffic to the machine at home. In this configuration, I've never experienced problems with too many connections to my imap server, and have the added bonus of a secured and compressed connection -- which really helps on low bandwidth connections.

For what it's worth, to tunnel your connection, you can do the following:
ssh -L 8143:localhost:143 remote.server.address 
Then just set mail to use localhost as your incoming mail server, and in the advanced section, set it to use port 8143. Save your changes, and you should be all set.

note that you'll need to keep your ssh session running in a terminal window in order to keep the "tunnel" active.

[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: sdickers@mac.com on Feb 12, '04 01:53:19AM

I have 22 email accounts with my Macintosh Mail. I have an E-Mac and am running OS X 10.3.2 Panther. I am having problems with seding mail. The program interupts me constantly when I try to send mail by asking me if I want to try another SMTP server. I get a series of error messages. It is not uncommon for me to have 30 pieces of mail stuck in the outbox that I wanted to send immediately. This is a real time waster. I receive more than 1000 pieces of e-mail per day with this program.

Also, the script for eliminating duplicates never finishes. I have left it running for as long as three days and even that is not sufficient for it to find all the duplicates in my various mailboxes. I have have about 600 mailboxes, maybe more.

I am willing to use the script that you wrote, but I am not a programmer and have never written my own script. Where do I enter it?

I have Microsoft Entourage. It came with Office. Perhaps it would work better. Do you know. Also, I have considered Netscape Mail or Thunderbird.
My Netscape Mail won't even access my six Netscape Mail accounts so I am reluctant to trust it with anything else. I was somewhat overwhelmed by Entourage when I tried to use it.

I would appreciate any guidance that you can offer.



[ Reply to This | # ]
Mail.app needs to be fixed/patched
Authored by: gjm25 on Dec 09, '03 11:53:31AM

This mail.app 'bug' has been troubling me for some time. Our small organisation works behind a router connecting via IMAP to an external ISP. Whilst the ISP is very friendly and have actually increased the number of connections allowed per IP, it is still not enough for 4 Mail.app clients when people start switching between folders. We really need a fix to limit the number of simultaneous connections that Mail.app will make.



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: bservo on Feb 01, '04 01:40:05PM

I've been seeing the same behavior for about a month now, except I've got 4 .mac e-mail accounts and one non-.mac account. This configuration worked fine for the longest time. I'm not sure what's changed... perhaps Apple changed their .mac e-mail server configuration?

This is most certainly a bug with Mail.app... because once I get the error message, Mail hangs and won't do anything else until I Force Quit it. I haven't been able to stop the hung threads in the Activity Viewer, and the normal Quit doesn't work.

The work around that's been working okay for me is that I've taken two of the .mac e-mail accounts that I don't use frequently and leave them offline until I want to check them.



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: TommyTheKid on Feb 12, '04 01:15:48AM

I have this same problem... the first account to "go" is usually my .mac account.. my other accounts are soon to follow.. I am the admin for each of the others, and the limit is *20* connections per IP (Sun ONE Messaging Server) .. which is (I think) what .mac uses on the back end.. not sure what their front-end is.. So if I leave the SSL unchecked and give my password out to the whole world every time I check my mail (esp in wireless environments), this problem wont be a SSL streams error? then what is the error ?


Tommy

---
Tommy The Kid



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: jamesks on Mar 12, '04 12:31:28PM

Since I installed Pather when it was released, Mail.app has been working very badly with our IMAP server. It continually generates error messages usually in a string of 10 or 12 when it connects to the server, but not all the time. the University technical spport users of Mail.app have no problem and suggest it could be using multiple folders that is causing the problem. there do not seem to be problems with other clients. This is very frustrating. Chaning use of SSL does not make any difference. It could well be the number of connections it is trying to make, but I have found little or no discussion of issue on bulletin boards. any iadeas or whould I just dump Mail (since I can;t change the server)



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: creativearc on Jun 09, '04 10:09:22AM

I'm unable to find the config file four Courier. No man page, no docs, and I can't find any helpful links on the Web.

Any ideas where this file might be?

---
Minneapolis Web Development
http://www.creativearc.com



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: k0fcc on Mar 09, '05 07:40:11PM

Excellent hint. This saved me when I moved to a new provider! Thank you!



[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: ZZamboni on Aug 24, '05 02:45:58PM
Thank you for this hint. I just switched my home server from Cyrus to Courier, and this problem was driving me crazy. Now everything is working fine again!

[ Reply to This | # ]
A potential fix for Mail.app and IMAP problems
Authored by: sfuller on Aug 24, '05 04:53:48PM

I will add that this appears to possibly something specific to using mail.app and courier-imap setups. I have used mail.app consistantly from 10.2 through 10.4 at home with cyrus imap and I have never dealt with any issues like this. I have connected to it over diaup, broadband, and over a LAN connection.

It's too bad that the issue exists however.



[ Reply to This | # ]
"CacheOveraggressively", "Automatically Synchronize" and also "DaysBetweenSyncs"
Authored by: Strolls on Sep 16, '08 10:01:11PM
Hi there,

I just found this post because it's about the only thing that comes up when you Google the "CacheOveraggressively" key from the com.apple.mail.plist file.

I think you're incorrect in saying it "is only equivalent to the 'Automatically Synchronize' on the advanced account pane" - I already had that ticked, and yet "CacheOveraggressively" was set to "NO". Perhaps changing it to "YES" will cause that tickbox to be flipped, but perhaps checking 'Automatically Synchronize' alone does not affect "CacheOveraggressively"? Anyway, using Plist Editor I have flipped it to "YES" for both my accounts to see what difference it will make, although since I have just upgraded from 10.4.9 to 10.5.5 on this machine, it may be difficult to attribute any changes I see. I have been running 10.5 on my laptop for some time, so will try it on that, too - perhaps it will make it behave better in offline mode?

There is also a "DaysBetweenSyncs" key in the plist file. Unrelated to the topic of courier-imap (which I also use - I have always had MAXPERIP set high), I have now set this to 1 for both accounts. I have noticed in the past that when I get up in the morning & read my mail, mailbox unread message-counts are not updated in unread mailboxes (messages are filtered on the server) unless I manually sync. Hopefully this will ensure that I get fresher updates without having to "Send & Receive" manually. Incidentally, for my accounts "DaysBetweenSyncs" were set to different values of 3 & 5, but Googling for that string only returns one other thread, in which posters mention theirs to be set to 21 & 28 days!

[ Reply to This | # ]