How to connect to Exchange from Linux


Photo by Bellah

The OpenChange project has produced libmapi, a framework to allow Linux developers to connect to Exchange using the same MAPI/RPC protocol that Outlook uses. This potentially gives you access to the full range of data held on an Exchange server, so I've been experimenting with it for Mailana.

It's very much still in development, so you'll likely have to build it yourself from source, along with Samba which it heavily relies on. That Samba dependence also means any code you link libmapi against also has to be released under the full GPL. In practice, you'll probably want to build a simple command-line tool or some other thin interface to hide the MAPI nastiness anyway, so the rest of your system doesn't have to go GNU.

Initially I downloaded the April 08 'phaser' stable release of the code, but subsequently moved to the top-of-tree to get some of the calls that have been added recently. A new stable release is due within a few days, the code is frozen and waiting for the official release of the Samba version it relies on.

The best place to get started is to browse a few of the example utilities included. If you're interested in mail messages, openchangeclient and exchange2mbox are good demonstrations. For appointments and meetings, check out exchange2ical. There's definitely still parts remaining to be implemented, but in my tests it worked flawlessly grabbing the basic information for all messages on an Exchange server. There were some bugs I had to work around, like the recipient's email addresses and display names showing up in the wrong members of a structure, but overall it was very impressive.

I'm going to keep hacking on libmapi, putting together some issue reports and hopefully finding some possible fixes. Julien Kerihuel and the other developers deserve a lot of credit for tackling such a painful API, I'm looking forward to seeing a lot of interesting projects taking advantage of their work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: