Five Pounds of Flax

Every culture has a burrito.

IDLE support for IMAP accounts in Apple's Mail.app

Monday, September 18, 2006posted by Michael Rothwell @ 11:18 PM

Apple's mail client (Mail.app) supports IMAP accounts, but does not support the IDLE extension (RFC 2177). IDLE is good, because it lets the server notify clients when new mail arrives, meaning that clients don't have to poll. Or at least, will get new mail more often than $POLL_INTERVAL.

I'm writing a plugin (a "mailbundle") for Mail.app that implements support for IDLE. It opens a connection for each IMAP account, selects the INBOX, enters IDLE mode, and waits for messages. When it gets a message from the server indicating that new mail has arrived, it causes Mail.app to check for new mail in that account.

The first working version is running in debug mode on my Mac right now, monitoring mail over an SSL connection to my IMAP server. It won't reconnect if disconnected, currently, and ignores network state. Those are to-do items.

I'll release it on VersionTracker when it's ready for public consumption.

** UPDATE
The first release version can be downloaded here (link disabled). It's a Universal Binary, reconnects when disconnected, and is working well on my MBP and my wife's Powerbook. You must be running Tiger (10.4.x) to use this.

** UPDATE
Not all IMAP servers support IDLE. As a future update to the IDLE plugin, I'll have it report back about your server's capabilities. Until then, here's a page describing how to tell if your server supports IDLE. Long story short: iPlanet and DotMac do not! Exchange does, as does cyrus and dovecot.

** UPDATE
Version 1.01 is available here: IMAP-IDLE-1.01.zip (link disabled). It is a minor update to fix problems some folks were having with particular IMAP servers; the plugin was failing to recognize that the server was in IDLE mode due to the server giving a response unexpected by my code. If version 1.0 is working for you, there's no reason to update to 1.01.

** UPDATE
I've gotten a number of great bug and usage reports. Thanks, everyone! I'm working on the following issues:
  1. Observing the "enabled/disabled" status of individual mail accounts
  2. Observing the "online/offline" status of Mail.
I'll have an update out in the next day or two, probably!

** UPDATE 2006-09-26
Version 1.02 (link disabled) is available. It respects the "enabled" setting for individual accounts, and handles accounts being taken "offline". It also checks for your server's capability to support the IDLE extension and reports yea or nay back in the console log (see /Applications/Utilities/Console.app). This version is working for my very small group of testers (me, my wife). Give it a shot!

** UPDATE 2006-09-30
Version 1.03 is available here.


13 Comments:

At 9/25/2006 11:24:00 AM, Blogger Dave said...

hmm... I know my mailserver supports IDLE (running courier-imap, and I use it with ChatterEmail on my Treo 650), but it seems like after adding the bundle it's still not doing anything (and yes, I quit mail and issued the two 'defaults' commands, too).

 
At 9/25/2006 03:55:00 PM, Blogger Michael Rothwell said...

Hi,

Try version 1.01. Blogger's really slow today, otherwise the link would already be there.

 
At 9/25/2006 06:39:00 PM, Blogger Chris Rosa said...

This post has been removed by a blog administrator.

 
At 9/25/2006 06:41:00 PM, Blogger Chris Rosa said...

Let's try that again...

Kerio Mailserver supports RFC 2177 Idle. I'll give it a try.

 
At 9/25/2006 07:02:00 PM, Blogger Chris Rosa said...

Your plug-in works well with Kerio so far. I'll try it out for a week and let you know how it goes.

 
At 9/26/2006 04:17:00 PM, Blogger JB said...

This is great, thanks for releasing it!

I'm having my incoming mail sorted on the server (.procmailrc rules). Will your plug-in be able to tell me when there's new mail in a sub-folder?

 
At 9/26/2006 06:08:00 PM, Blogger Dave said...

With each update, do we have to then 'reissue' the two appropriate terminal commands?

 
At 9/26/2006 06:12:00 PM, Blogger Michael Rothwell said...

No, issuing them once should be sufficient.

 
At 9/27/2006 05:38:00 PM, Blogger John said...

I get this in the console:

2006-09-27 17:23:21.837 Mail[280] IM_NOT_AUTHENTICATED: xxxx: * BAD Protocol Error: "Command received without terminating CR LF sequence".

Ideas?

 
At 9/28/2006 03:35:00 PM, Blogger Mani_Lx said...

It works. BUT when internet connection is lost it often brings mail crashing...

 
At 9/28/2006 08:22:00 PM, Blogger Erik Veit said...

How does one uninstall this? TIA!

 
At 9/29/2006 10:24:00 AM, Anonymous Anonymous said...

Works good here, but I whenever I lose routing capability (Working in a wireless network that requires authentication), the Mail.app crashes.

 
At 9/29/2006 10:25:00 AM, Blogger Dave said...

Yep... crashing here when waking from sleep with Mail.app running. I imagine that's similar to what the above poster is seeing.

 

<< Home