Tuesday 7 April 2009

Exchange 2007 IMAP RFC822.SIZE and Pine/Alpine

A common problem with Exchange 2007 IMAP when used with Pine/Alpine is alerts indicating that a message has shrunk. What is happening here is that Pine is retrieving the RFC822.size from Exchange, downloading the message and comparing the real message size with the size Exchange 2007 provides. Sadly there often is a huge discrepency, sometimes by as much as a factor of two. Interestingly Pine only checks for size decreases in case of data loss during copy hence you only see this message appear on some emails, not all. If Pine checked for message decreases and increases you would see it for pretty much all emails.

Microsoft have so far explained that the size returned by Exchange prior to Exchange 2003 was based on the MIME message stored in the STM database. As the STM database no longer exists in Exchange 2007 the RFC822.size is calculated based on the MIME skeleton and the original MIME message size. This is done for performance reasons. I have asked Microsoft for clarification as to why the original MIME size of the message is vastly different to the regenerated MIME message and am waiting for clarification.

There is an Alpine code change that will supress this message (if you are happy to lose the safety check), or you can apply a change to Exchange on either a server or on individual mailboxes. The setting is nothing secret but documentation is very scarce. It is worth mentioning that making this change has a performance penalty as it forces Exchnage to regenerate each message as MIME and then send the size of the regenerated MIME message every time a message size is read.

For the server:

Set-ImapSettings -EnableExactRFC822Size:$true

For each user:

Set-CASMailbox "username" -ImapUseProtocolDefaults:$false -ImapEnableExactRFC822Size:$true


Although this solves this particular problem, sadly other issues persist with Pine and Exchange 2007 like Pine crashing when opening messages with Digital signatures and Pine not handling multipart messages correctly. It seems that although these issues only appear in Pine/Alpine (and perhaps Mutt), it appears to be Exchange that is failing to follow the RFC standards (and Pine is a stickler for standards!).

I'm sure we will get there soon!