Using Mutt for my e-mail, I’d like to see full details of meeting requests that people send me in Microsoft Exchange. Unfortunately, getting e-mails out of Exchange has always proven to be a pain in the past, and meeting requests have fallen into the same bucket. I’ve essentially resorted to a single Outlook rule (it’s actually, an Exchange server-side rule) to forward all incoming e-mail to my Mutt mailbox as an attachment.
Why as an attachment? If it’s not, you lose all the message headers, can’t find out who the e-mail was CC’d to, and all the e-mail looks like it comes from me. That’s not really very useful, or how forwarding works in pretty much every other MTA on the planet (thanks Microsoft).
This means that all e-mail arriving in Mutt forwarded from Exchange comes from me (my Exchange mailbox) and goes to me (my Mutt mailbox), and contains a MIME attachment of type message/rfc822, which is the actual message I’m interested in. Makes searching for messages in the index rather difficult, but at least all the information is preserved.
So, meeting requests end up in Mutt with a message/rfc822 attachment, containing a multipart/alternative group of text/plain, text/html, and text/calendar (vCalendar). Mutt looks at the multipart/alternative and displays the one it knows about, which is the text/plain part. This is usually just a short summary of the meeting.
However, because it’s embedded inside an e-mail from and to me, they’re rather hard to find in my inbox. If I set Exchange to forward meeting requests not as an attachment, I can’t see who else the meeting request was sent to, as they are in the To and Cc headers of the original mail, which Exchange has now conveniently removed. And I still can’t tell that they’re actually a meeting request.
To the rescue comes the text/calendar attachment. This contains all the data I need in vCalendar format, but Mutt ignores it. We can fix that somewhat with the following Mutt configuration option:
This tells Mutt to display the text/calendar part in preference to the text/plain part.
We can now tell Exchange to forward meeting requests first, not as an attachment, and not process any more rules. Then set up a rule to forward all other mail as an attachment.
To now highlight the meeting requests, I added:
color index black yellow "~b text/calendar"
which shows all meeting requests as black on yellow in the index. The pattern match is based on the body of the message containing the text ‘text/calendar’. You can’t match on things such as the ‘~~~~~~~’ line Exchange puts into the meeting requests (about the only other identifying feature) because all of the MIME parts are base64 encoded. Even the plain text one.
The final step is to decode the vCalendar text into something that’s a bit more readable. I found a nice perl script on the web by Martyn Smith that decodes them. Save the script as /usr/local/bin/vcal2text and then put the following in your ~/.mailcap file:
text/calendar; /usr/local/bin/vcal2text '%s'; copiousoutput
Finally, tell Mutt to automatically filter text/calendar MIME parts using this script:
And we’re done. Meeting requests show up in the index highlighted in yellow, and they decode and display nicely, looking like e-mails. Just something that slightly reduces the pain of having to work in a very Exchange-centric environment.