mailbox2ics

We have an Exchange-like mail server at work, but it doesn’t support iCal subscriptions. Since I use a Mac, and don’t have any interest in Outlook, that makes calendar access a pain.

After some poking around, I discovered that the server stores the calendar information in IMAP folders, with each event in a separate ICS file attached to a fake message. So I put together a small script read the IMAP messages and merge the ICS files into a single output file. By writing the output file to a folder on the web server, it is easy to set up a subscription in iCal.

The result only works one way, of course, though it should be possible to push fake messages into the IMAP server. I have not tried that, because I just use the server’s web interface for adding new events to the calendar.

The script depends on the icalendar package from codespeak.net, and the Python standard library packages for IMAP and email parsing.

I have posted the script to my server: mailbox2ics.