Open Source Access to MS Exchange Server Using DavMail

Visual

This article introduces DavMail and demonstrates its importance in corporate scenarios for accessing mail from MS Exchange Server.

Many enterprises use Microsoft Exchange for corporate e-mail; usually, there’s no avoiding it. While Exchange can provide IMAP/POP services, these are frequently disabled citing security reasons, leaving Outlook Web Access (OWA) as the only hope for users of non-Microsoft mail user agents (MUAs). But losing important emails is one of the major concerns, due to the limited space provided by Exchange Server. Apart from this, there are many Linux enthusiasts and government authorities who have now stopped working on Windows due to the increasing popularity of Ubuntu and similar Linux distros. Moreover, organisations invest huge amounts on purchasing MS Outlook for each desktop.

MS Exchange uses proprietary MAPI protocols, which are incompatible with the open protocols that Thunderbird and other clients use. So here’s a nice solution that lets you use any email client to connect to Exchange Server with a third-party gateway, in a secure way (optional encryption) and, of course, it’s free. The popular FOSS website SourceForge.net explains its architecture: The main goal of DavMail is to provide standards-compliant protocols in front of proprietary Exchange. This means LDAP for a global address book, SMTP to send messages, IMAP to browse messages on the server in any folder, POP to retrieve inbox messages only, CalDAV for calendar support, and CardDAV for personal contacts sync. Thus, any standards-compliant client can be used with Microsoft Exchange. The DavMail gateway is implemented in Java, and should run on any platform. Releases are tested on Windows, Linux (Ubuntu) and Mac OS X. Tested successfully with the iPhone (gateway running on a server).

Figure 1 shows various applications using DavMail (the yellow icon) to connect to OWA (Outlook Web Access) and Exchange. Using OWA instead of proprietary MAPI or IMAP/SMTP protocols itself ensures secure communication with the server. For smartphones, DavMail is used as a dedicated host to provide SMTP and IMAP services to those devices, hiding all the server configuration from those so-called less secure Internet devices. It also supports set-up of calendars and CardDAV protocol to sync address books.
We tested DavMail 3.9.9 using Thunderbird 13.0.1 (you can explore the latest versions) with Lightning (a Thunderbird add-on for the Calendar set-up) on Windows XP and Windows 7. Given below are the steps to set it up.

Download and install Mozilla Thunderbird from http://www.mozilla.org/thunderbird/ and DavMail from http://davmail.sourceforge.net/download.html.
Figure_1
DavMail configuration
After installation, you can find DavMail running in your system tray. Right-click it and select Settings. In the Main tab, enter your Outlook Web Access URL (see Figure 2). Leave the rest as it is. Go to the Proxy tab and enter your proxy details if you are behind a proxy server; else, skip this.
Now, DavMail is running on our desktop itself localhost. If it’s installed for use as a service on a dedicated host, you’d use the IP address/hostname for that system in your email client settings for instance, as is shown below for Thunderbird.
Note: We recommend you uncheck the option SMTP save in sent in DavMail -> Advanced settings. This will avoid having two copies of an email in Sent Items.
Figure_2  Figure_3
Thunderbird account configuration
Run Thunderbird after installation. The first run will start a wizard to create an account. Enter your name, email ID and the password given to you by your IT support team and click Continue. Now Thunderbird will try to auto-configure the account; just stop it by clicking the Stop button. You should get a plain configuration screen with some default values. Click the Manual Setup button and set up localhost as the server hostname, and the ports defined in DavMail: POP port 1110, IMAP port 1143 (for receiving email from Exchange); and SMTP port 1025 (to send emails).
Figure_4
Also ensure that Connection Security (in Server Settings for the account) is None (that’s for the connection between Thunderbird and DavMail), and configure the other account settings according to your requirements.
Next, let’s look at LDAP configuration. In your Account Settings dialogue box, select Composition & Addressing in the left pane and choose Use a different LDAP server (Figure 3). Click Edit Directories, and you will be shown an LDAP server configuration dialogue box. Click the Add button to add your local LDAP server. Here are some sample settings (except the port):
Name: Exchange
Hostname: localhost
Base DN: ou=people
Port number: 1389 (the port set in DavMail configuration; Thunderbird will use this to fetch address books from Exchange so it can auto-complete email addresses in new messages.)
Bind DN: domainname\username
Click OK twice to return to Composition & Addressing, and select the newly created Exchange entry under Use a different LDAP server.
Calendar configuration
Now you need to synchronise your calendar with Exchange Server to receive event notifications in Thunderbird. For this, you need the Lightning add-on, which you can easily install from https://addons.mozilla.org/en-US/thunderbird/addon/lightning/. Next, from Thunderbird’s File menu choose New -> Calendar. Select On the Network and click OK. Select Format as CalDAV (see Figure 4). Enter Location as http://localhost:1080/users/[email protected]/calendar (sample setting, replace with your details). DavMail’s CalDAV port is 1080. Click Next. Enter some nickname for your calendar, and click Next and Finish.
Note: There are various add-ons available other than CalDAV for Thunderbird, like Exchange 2007/2010 Calendar and Task Provider and Provider for Microsoft Exchange, which are also useful for calendar configuration in Thunderbird. The first one looked very useful—it allowed me to specify Out of Office settings and automatic responses to meeting requests but remember that it’s not supported for Thunderbird 15 or later.
Voilà! That’s it. Now you are ready to use Thunderbird through DavMail to access MS Exchange Server. Go ahead and enjoy the beauty of FOSS!

All published articles are released under Creative Commons Attribution-NonCommercial 3.0 Unported License, unless otherwise noted.
Open Source For You is powered by WordPress, which gladly sits on top of a CentOS-based LEMP stack.

Creative Commons License.