Home Uniquely NZ Travel Howto Pauline Small Firms Search
Accessing a Microsoft Exchange Server from Linux
The DavMail Gateway

Introduction to the Microsoft Exchange Server

Many large firms, government agencies and universities use Microsoft Exchange. Microsoft Exchange is a proprietor collaborative application product developed by Microsoft. Exchange's major features consist of electronic mail, calendaring, contacts and tasks; support for mobile and web-based access to information; and support for data storage. It uses a non standard proprietory protocol called EMAPI owned and licensed by Microsoft.

Client Software to Access the Exchange Server

Microsoft Outlook is a personal information manager, available separately application and as a part of the various Microsoft Office suites. It is the optimum client designed to work with Microsoft Exchange Server and it is claimed to have 500 million users. As well as e-mail, it also includes a calendar, task manager, contact manager, note taking, a journal and web browsing. It can be used as a stand-alone application, or can work with Microsoft Exchange Server and Microsoft SharePoint Server for multiple users in an organization, such as shared mailboxes and calendars, Exchange public folders, SharePoint lists and meeting schedules. When this article was first writen the current version was Microsoft Outlook 2010 for Windows and 2011 for Mac and they 'only' cost£119.99 as a standalone program. Not surprisingly there is no version for Linux.

The Outlook Web App (OWA), originally called Outlook Web Access, is a webmail service of Microsoft Exchange Server. The web interface of OWA resembles the interface in Microsoft Outlook. OWA is used to access e-mail, calendars, contacts, tasks, and other mailbox content via a web browser and offers much of the functionality of Microsoft Outlook. The most important difference is that Outlook allows users to work when an internet connection is unavailable, whereas OWA requires a fast internet connection to function. The OWA interface comes in two flavours, one with a complete feature set and an alternative 'Lite' version with reduced functionality. The full version requires Internet Explorer 7 or later, Mozilla Firefox 3.01 and later, Google Chrome or Apple Safari 3.1 whilst the Lite version is rendered in most other browsers.

Mobile Devices Most Mobile Devices, Android and iPhone certainly, have a built in Exchange Client usual called Exchange Active Sync which offers subset of the full Outlook Exchange Client. Although Exchange Active Sync is available on Android which uses the Linux kernel, it does not seem to be available for Linux.

Access via IMAP and POP. The Outlook Exchange Server email can be set up to be accessible via IMAP or POP and SMTP although, not surprisingly, Microsoft has not implemented the full standards and conventions used by almost everyone else. These is the best way to be able to continue to work when an internet connection is unavailable or expensive and you can not afford to purchase Outlook or one uses Linux. It can also be used on a mobile. POP and IMAP is not switched on by default and many firms do not implement it.

DavMail Gateway. This is the main subject of this paper and allows standard email clients, calendars and contacts to have access through the OWA interface protocols (!Webdav or EWS depending on version). DavMail is available for Linux and every issue is checked under Ubuntu.

The DavMail Gateway

The DavMail Gateway is an open-source exchange gateway that enables users to use any mail/calendar client (e.g. Thunderbird with Lightning or Apple iCal) with any Microsoft Exchange server from most operating systems. DavMail gateway is implemented in Java and should run on any platform. DavMail is written in Java andreleases are officially tested on Windows, Ubuntu Linux and Mac OS X platforms. DavMail Gateway's operation is simple yet elegant: it uses Outlook Web Access to retrieve your e-mail, calendar and contacts from your employer's Exchange server and then retransmit them to your local client using standard compliant protocols. This means LDAP for 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 standard compliant client can be used with Microsoft Exchange. In the case of Linux the obvious candidate is Thunderbird with the Lightning extension for Calenders and Contacts.

The DavMail Gateway is a small program which has to be running whilst Exchange is being accessed. On Linux Mint it sits in the System tray and the settings etc can be accessed on a right click menu. It is run from the normal menu and can be added to the start up menu so that it is always running whilst the machine is on - I have not done that until I know the resources required, at a first look it seems that there is no CPU load but a memory footprint from Java of 150 Mbytes which seems very high.

Installing DavMail

When this section was last updated in June 2015 Linux Mint was at version 17.1 which was based on Ubuntu 14.04.

DavMail is not available in the Ubuntu/Mint Repositories and I have not found a PPA yet which has it so it has to be downloaded as a .deb file from the website - mine was davmail_4.6.1-2343-1_all.deb (5 mbytes) and I downloaded to the desktop. I used the gdebi installer which should be called if you double click on the package or via the right click menu. gdebi automatically installs any dependencies (other packages which are required for it to run). On my system two small extra packages were installed (total download size 200 kbytes). I am not sure if gdebi is installed by default in Ubuntu or Mint so you may need to install it using the synaptic package manager or from the terminal.

sudo apt-get install gdebi

DavMail is a Java program so Java will be installed if you do not already have it - that is a big download so do it on Wifi not mobile! You should already have the Open Source Java (openjdk-7) installed and that should satisfied the dependencies without the real Oracle Java. I have Oracle Java 8 installed on my own machine as well and that machine is configured to use it so I can not check for problems with the Open Source Java until I have checked on another machine. Installing Oracle Java is not to be undertaken lightly and involves 60 Mbyte downloads!

Once I had run gdebi that was it - it was working 'out of the box' under Mint when I ran it from the main menu sitting in the system tray. Only one parameter has to be setup in DavMail Settings which is the OWA (Exchange) URL. Everything else should be left at the default settings unless you have a port conflict - the screen below makes it clear.


Ubuntu System Tray re-enabling

DavMail makes use of the system tray and it is difficult to change the settings without it. Ubuntu has restricted access to the System tray (unlike Mint) but there is a work-round which is well described on WebUp8 - How To Whitelist Systray Apps In Ubuntu 14.04 Or 14.10 (w/ Unity) which is recommended by the DavMail project.

Davmail Updates

Periodically Davmail will inform you updtaes are available and you can go back to the website and download and install the latest version.

Thunderbird Settings when using the Davmail Gateway

Thunderbird is set up just as usual except that the servers are all localhost and the ports are as per those set in the Davmail Gateway ie POP is 1110, IMAP is 1143 and SMTP is 1025. At present we have not tried calendering etc. You get to Thunderbird Accounts by Edit -> Account Settings -> Account Actions -> Add Mail Account and use Manual Setup. The POP and SMTP settings should look like thiswhen you are finished:



And thats it. Run DavMail first, then Thunderbird and collect and send your mail! DavMail can be closed by a right click -> Exit on the icon in the system tray.

Compatibility of DavMail Gateway with existing Exchange POP and IMAP accounts in Thunderbird.

My tests so far have involved making new POP and IMAP accounts when using DavMail. If the DavMail Gateway is completely compatible IMAP and POP accessed directly from the server it should be possible to just change the Server Name, Port and Authentication on an existing account. This would avoid having to reload all the emails and maintain an existing local filing system.

My initial tests on a POP mailbox show that all the existing folders remain as expected but after the password is input all the emails on the server start to download, oldest first. This will give duplicates in the inbox of emails which have not been files or deleted. Next time I will move all the existing inbox messages to a temporary folder until the whole inbox is downloaded at which point the older emails can be deleted and the temporary folder moved back.

I have only partially tested the compatibility with existing accounts and strongly suggest that the profile is backed up before any such tests, especially if emails are partially downloaded as a limit on size has been set when using POP.


I have only been able to carry out tests on one version of Exchange Server so far. I have only tested email not Calendars or Contacts. Within those boundaries it has all worked exactly as expected out-of-the-box on a mailbox with several thousand emails over a period of many months on two machines.

My testing has only been on Linux but this should allow use of Thunderbird/Lightning on Windows systems as free Open Source alternative to Outlook.

Before You Leave

I would be very pleased if visitors could spare a little time to give us some feedback - it is the only way we know who has visited the site, if it is useful and how we should develop it's content and the techniques used. I would be delighted if you could send comments or just let me know you have visited by sending a quick Message.

Link to W3C HTML5 Validator Copyright © Peter & Pauline Curtis
Fonts revised: 29th April, 2021