How to connect Thunderbird to Exchange - DavMail Server


Mozilla Thunderbird, one of the most popular email clients, still suffers from one serious disease: it does provide neither built-in mechanisms nor third-party plugins for RPC MAPI connection to MS Exchange Server. As an email services administrator I always used to support my customers by enabling direct SMTP / IMAP connection then. However as my company has recently changed its security policy and decided to block raw SMTP / IMAP access to our MS Exchange infrastructure I was forced to find out an alternative solution for my Thunderbird users. After hours spent on digging for a best possible solution I have finally found DavMail. It occurred that it is some kind of proxy, written in Java, that runs SMTP / IMAP servers locally and connects to MS Exchange via OWA. I managed to run DavMail in a server mode on a standalone VM. After that I provided my Thunderbird users with the VM details and now I have all of them connected to company MS Exchange infrastructure. The following HowTo presents details steps describing how did I achieve that.


To set up the DavMail in a server mode on a VM follow the instructions below:

1) Set up a VM with Ubuntu Server 12.04 64-bit with X Server (Unity preferably).

2) Install OpenJDK and SWT by running the following command:

# apt-get install openjdk-7-jre libswt-gtk-3-java

3) Download the newest available version of DavMail and install it both with required dependencies by issuing the following command:

# dpkg -i davmail*.deb
# apt-get -f install


1) To run DavMail in a server mode create /etc/davmail directory and put file there. Adjust the following settings to fit into your organization requirements:


The most important ones are davmail.url that indicates your OWA URL and davmail.allowRemote that you need to turn to true to support server mode. Moreover in my case I also disabled POP server and changed davmail.caldavPort, davmail.imapPort, davmail.ldapPort and davmail.smtpPort values into regular port numbers of HTTPS, IMAPS, LDAPS, and SMTPS services respectively.

2) As all of the HTTPS, IMAPS, LDAPS and SMTPS services run over TLS you will need a certificate in PKCS12 format attached. To generate it, assuming that you have the following in a PEM format: CA.pem, server.pem and server.key run the following command:

openssl pkcs12 -export -in server.pem -inkey server.key -certfile CA.pem -out server.p12

Alternatively you can create a self-signed certificate or not attach it at all. Your setup will not be secure then, so it is highly recommended to use TLS anyway.

3) Adjust the following settings of configuration file:


Running DavMail Server

To run DavMail add the following line into the /etc/rc.local script before the exit 0 line:

nohup /usr/bin/davmail /etc/davmail/ &

After that you will notice that you VM starts listening on TCP ports 443, 465, 636 and 993. Follow the instructions on official DavMail website to configure your Thunderbird client.

No comments:

Post a Comment