This blog is my notebook for computer and technology related information, copies of useful webcontent (with refs of course), troubleshooting, general tips and setups that work well for me.

Useful tags:

Blog

Introduction

DavMail provides a solution for translating Microsoft Exchange to open protocols like POP, IMAP, SMTP, Caldav, Carddav, and LDAP.

Installation

Davmail requires some extra dependencies to work properly. Install them with apt:

sudo apt-get install default-jre libswt-gtk-3-java libswt-cairo-gtk-3-jni

The DavMail project makes a Debian package available on their website through [SourceForge (http://sourceforge.net/projects/davmail/files/davmail/).

Download the latest Debian package with wget:

wget http://sourceforge.net/projects/davmail/files/davmail/4.4.1/davmail_4.4.1-2225-1_all.deb

Then, install DavMail with dpkg:

sudo dpkg -i davmail_4.4.1-2225-1_all.deb

Basic Configuration

DavMail's configuration file does not exist by default. Create one with your favorite text editor:

sudoedit /etc/davmail.properties

Set DavMail to server mode so it doesn't require X11:

davmail.server=true

Enable remote mode and set the bind address to your servers IP address or set it blank:

davmail.allowRemote=true
davmail.bindAddress=

Set davmail.url to your Outlook Web App/Outlook Web Access URL, which usually ends in /owa:

davmail.url=https://yourcompany.com/owa

Set your connection mode:

davmail.enableEws=auto

Set your port options:

davmail.imapPort=993
davmail.smtpPort=465
davmail.ldapPort=636
davmail.popPort=995
davmail.caldavPort=8443

Save and close the configuration file.

Create A SSL Certificate

Use the Letsencrypt Certbot to create a certificate.

Configuring SSL

cd to /etc/letsencrypt/live/your-server and convert the letsencrypt certificates to a p12 file using this script. You must use a PASSWORD on the file!

#!/bin/bash
sudo openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -certfile cert.pem -out /etc/ssl/certs/davmail.p12

Add the following configuration options to inform DavMail of the location of the pkcs12 file you just generated and the passphrase you set:

davmail.ssl.keystoreType=PKCS12
davmail.ssl.keystoreFile=/usr/lib/ssl/certs/davmail.p12
davmail.ssl.keyPass=PASSWORD
davmail.ssl.keystorePass=PASSWORD

Both davmail.ssl.keyPass and davmail.ssl.keystorePass should should have the same value. Save the configuration file.

DavMail is now configured to use your SSL certificate.

Start DavMail

The Debian package we downloaded eariler does not contain an init script, so we must create our own.

You can also try starting davmail using

sudo davmail /etc/davmail.properties

To have a proper startup job is better, of course:

Create a new file with your favorite text editor:

sudo nano /etc/init.d/davmail

Copy and paste the following into the file: davmail

Save and close the file.

Mark the script executable, start the service, and enable it at boot:

sudo chmod +x /etc/init.d/davmail
sudo service davmail start
sudo update-rc.d davmail defaults

Client Configuration

Now that the server is running, you are ready to configure your E-mail clients.

Mail setup

Create a new account, using the “manual” options of your E-mail client. Both the IMAP and SMTP server will be the domain name or IP address of your droplet, depending on what you used for the Common Name on your SSL certificate. The username for IMAP and SMTP will both be your E-mail address without the domain name. Example: Your E-mail is bob@yourcompany.com, so your username is bob. Make sure both IMAP and SMTP are set to use SSL/TLS and not STARTTLS.

Specific instructions for Thunderbird, Mac OSX, and iOS is available at DavMail's website.

You should now be able to send/recieve E-mail using your Microsoft Exchange E-mail account using open technologies!

Calendar setup in Thunderbird

In the thundebird calendar create a new networked calendar

Name: your-company
Location: https://your-company.tld:8443/users/your-name@your-company/calendar

LDAP Directory setup in Thunderbird

The following worked for me to connect to an exchange server through davmail.

In the address book set up a new server

Name: your-company
Hostname: your-server
Base DN: ou=people
Port number: 636
Bind DN: your-name@your-company

Ref: Original by Jesse TeKrony https://www.digitalocean.com/community/tutorials/how-to-setup-a-davmail-exchange-gateway-on-a-debian-7-vps

2018-10-11 14:57 · brb

Archive

Blog History

2009-05: 18 entries 2009-06: 12 entries 2009-07: 9 entries 2009-08: 5 entries 2009-09: 2 entries 2009-10: 2 entries 2009-11: 5 entries 2009-12: 4 entries 2010-01: 1 entry 2010-02: 3 entries 2010-03: 2 entries 2010-04: 2 entries 2010-05: 3 entries 2010-06: 10 entries 2010-07: 8 entries 2010-08: 5 entries 2010-09: 4 entries 2010-10: 6 entries 2010-11: 2 entries 2010-12: 6 entries 2011-01: 5 entries 2011-02: 3 entries 2011-03: 5 entries 2011-04: 2 entries 2011-05: 4 entries 2011-06: 5 entries 2011-07: 11 entries 2011-08: 12 entries 2011-09: 4 entries 2011-10: 4 entries 2011-11: 2 entries 2011-12: 1 entry 2012-01: 5 entries 2012-02: 2 entries 2012-04: 3 entries 2012-06: 1 entry 2012-09: 4 entries 2012-10: 1 entry 2013-04: 1 entry 2014-04: 10 entries 2014-08: 2 entries 2015-04: 1 entry 2015-09: 3 entries 2016-04: 1 entry 2016-05: 1 entry 2016-06: 1 entry 2016-07: 2 entries 2016-10: 1 entry 2017-01: 1 entry 2017-02: 2 entries 2017-04: 1 entry 2017-05: 1 entry 2017-07: 2 entries 2017-08: 1 entry 2017-10: 1 entry 2017-11: 1 entry 2017-12: 2 entries 2018-10: 1 entry

October

December

November

October

August

July

May

April

February

January

October

July

June

May

April

September

April

August

April

April

October

September

June

April

February

January

December

November

October

September

August

July

June

May

April

March

February

January

December

November

October

September

August

July

June

May

April

March

February

January

December

November

October

September

August

July

June

May