DavMail Setup as a standalone server

Prerequisite : Sun JRE 5, 6 or 7 or OpenJDK 6 or 7.

Davmail Gateway can run in server mode as a gateway between the mail client and Exchange server through Outlook Web Access and/or EWS. In server mode Davmail can run on any Java supported platform. This mode was tested successfully with Iphone and Android phones and should work with any equipment with POP/IMAP/SMTP/LDAP/Caldav/Carddav client. In this mode many users can share the same DavMail instance.

Download the noinstall package for Windows or platform independent DavMail package from Sourceforge and uncompress it with your favorite tool, e.g. on Linux: unzip davmail-*.zip.

Prepare a davmail.properties file according to your local needs :

# DavMail settings, see http://davmail.sourceforge.net/ for documentation

#############################################################
# Basic settings

# Server or workstation mode
davmail.server=true
# connection mode auto, EWS or WebDav
davmail.enableEws=auto
# base Exchange OWA or EWS url
davmail.url=https://owa.example.com/owa/

# Listener ports
davmail.caldavPort=1080
davmail.imapPort=1143
davmail.ldapPort=1389
davmail.popPort=1110
davmail.smtpPort=1025

#############################################################
# Network settings

# Network proxy settings
davmail.enableProxy=false
davmail.useSystemProxies=false
davmail.proxyHost=
davmail.proxyPort=
davmail.proxyUser=
davmail.proxyPassword=

# proxy exclude list
davmail.noProxyFor=

# allow remote connection to DavMail
davmail.allowRemote=true
# bind server sockets to a specific address
davmail.bindAddress=
# client connections SO timeout in seconds
davmail.clientSoTimeout=

# DavMail listeners SSL configuration
davmail.ssl.keystoreType=
davmail.ssl.keystoreFile=
davmail.ssl.keystorePass=
davmail.ssl.keyPass=

# Accept specified certificate even if invalid according to trust store
davmail.server.certificate.hash=

# disable SSL for specified listeners
davmail.ssl.nosecurecaldav=false
davmail.ssl.nosecureimap=false
davmail.ssl.nosecureldap=false
davmail.ssl.nosecurepop=false
davmail.ssl.nosecuresmtp=false

# disable update check
davmail.disableUpdateCheck=true

# Send keepalive character during large folder and messages download
davmail.enableKeepalive=false
# Message count limit on folder retrieval
davmail.folderSizeLimit=0
# Default windows domain for NTLM and basic authentication
davmail.defaultDomain=

#############################################################
# Caldav settings

# override default alarm sound
davmail.caldavAlarmSound=
# retrieve calendar events not older than 90 days
davmail.caldavPastDelay=90
# WebDav only: force event update to trigger ActiveSync clients update
davmail.forceActiveSyncUpdate=false

#############################################################
# IMAP settings

# Delete messages immediately on IMAP STORE \Deleted flag
davmail.imapAutoExpunge=true
# Enable IDLE support, set polling delay in minutes
davmail.imapIdleDelay=

#############################################################
# POP settings

# Delete messages on server after 30 days
davmail.keepDelay=30
# Delete messages in server sent folder after 90 days
davmail.sentKeepDelay=90
# Mark retrieved messages read on server
davmail.popMarkReadOnRetr=false

#############################################################
# SMTP settings

# let Exchange save a copy of sent messages in Sent folder
davmail.smtpSaveInSent=true

#############################################################
# Loggings settings

# log file path, leave empty for default path
davmail.logFilePath=/var/log/davmail.log
# maximum log file size, use Log4J syntax, set to 0 to use an external rotation mechanism, e.g. logrotate
davmail.logFileSize=1MB
# log levels
log4j.logger.davmail=WARN
log4j.logger.httpclient.wire=WARN
log4j.logger.org.apache.commons.httpclient=WARN
log4j.rootLogger=WARN

#############################################################
# Workstation only settings

# smartcard access settings
davmail.ssl.pkcs11Config=
davmail.ssl.pkcs11Library=

# SSL settings for mutual authentication
davmail.ssl.clientKeystoreType=
davmail.ssl.clientKeystoreFile=
davmail.ssl.clientKeystorePass=

# disable all balloon notifications
davmail.disableGuiNotifications=false
# disable startup balloon notifications
davmail.showStartupBanner=true

# enable transparent client Kerberos authentication
davmail.enableKerberos=false
            

See Getting started for more information on the options. Make sure davmail.server is set to true (no icon tray) and allow remote connections: davmail.allowRemote=true.

To disable a service, set an empty port value.

Launch Davmail with the following command:

nohup davmail.sh davmail.properties &
.

Then check messages:

tail -f nohup.out

Register DavMail windows service

A new WinRun4J davmailservice.exe wrapper is available in the windows package.

To register DavMail as a windows service, use:

davmailservice --WinRun4J:RegisterService
or
sc create DavMail binPath= \path\to\davmailservice.exe type= own start= auto

OSX LaunchDaemon

To launch DavMail on OSX with LaunchDaemon, you may try the following user provided script:

[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>davmail</string>
    <key>RunAtLoad</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/libexec/davmail/davmail.sh</string>
        <string>/usr/libexec/davmail/davmail.properties</string>
    </array>
</dict>
</plist>

DavMail Setup as a JEE Web Application

Prerequisites : Sun JRE 5, 6 or 7 or OpenJDK 6 or 7 and any JEE compliant web container

Davmail Gateway can now be deployed in any JEE application server using the war package. In this mode, DavMail listener threads run inside the application server and follow the web application lifecycle (start, stop, deploy, undeploy). The following items describe Tomcat deployment, details will vary according to the specific application server available.

Download the war DavMail package from Sourceforgedavmail-*.war, and deploy it inside the application server. In Tomcat, this means copy the war file to the webapps directory. If Tomcat is started and automatic deployment enabled (this is the default configuration), the package is automatically uncompressed and started.

The davmail.properties configuration file is then available under davmail-*/WEB-INF/classes.

Note: DavMail does not use the standard Tomcat HTTP connector and uses the same listeners in war and server modes. This means the HTTP port for Caldav url is specified in davmail.properties

See above and Getting started for more information on the options. Make sure davmail.server is set to true (no icon tray) and allow remote connections: davmail.allowRemote=true.