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.