
Installing DavMail on Ubuntu 26.04 is a practical way to connect Linux mail clients to Microsoft Exchange or Office 365 without fighting protocol limits. This guide shows you how to install it, configure it, and verify it works in a clean, sysadmin-friendly way.
In simple terms, DavMail translates Exchange access into standard mail protocols that your Linux tools already understand. That means Thunderbird, Evolution, Mutt, and similar clients can keep working on Ubuntu without forcing you into a Windows-only workflow.
In this tutorial, I will show you how to Install DavMail on Ubuntu 26.04 in a way that fits both desktop and server use. I will also explain why each command matters, so you do not just copy steps blindly. The goal is a setup that is easy to maintain, secure, and predictable.
Prerequisites
Before you start the DavMail on Ubuntu 26.04 setup, make sure you have the basics ready.
- OS version: Ubuntu 26.04 LTS.
- Permissions: A user with
sudoaccess. - Required account: A Microsoft Exchange or Microsoft 365 mailbox.
- Tools needed:
wget,apt, a terminal, and a text editor such asnanoorvim. - Java runtime: A JRE installed on the system, because DavMail runs on Java.
- Mail client: Thunderbird, Evolution, Mutt, or another IMAP and SMTP client.
Step 1: Update your system
Keeping your package index fresh helps avoid broken installs and missing dependencies.
Run the update commands
sudo apt update
sudo apt upgrade -y
apt update refreshes your package list. apt upgrade -y installs available security and bug fixes, which is important before you add a gateway service like DavMail.
Why this matters
DavMail depends on Java and system libraries. If your Ubuntu install is stale, dependency resolution may fail or pull older packages that do not behave well with the current LTS stack.
Expected output
You should see package lists downloading, followed by a summary of upgraded packages. If there are no updates, apt will say so clearly.
Step 2: Install Java
DavMail needs Java to run, so this is not optional.
Install the JRE
sudo apt install default-jre -y
default-jre installs the Ubuntu-recommended Java runtime. That is the safest choice for a Linux server tutorial because it avoids hardcoding a specific Java version unless you truly need one.
Verify Java
java -version
Why this matters
DavMail is a Java application, and the Debian package instructions list Java as a prerequisite. Without a JRE, the launcher can install but the program itself cannot start.
Expected output
You should see a Java version line such as OpenJDK and a build number. That confirms the runtime is available.
Step 3: Download DavMail
For Ubuntu, the official package is the Debian .deb build from SourceForge.
Get the package
Open the DavMail download page and copy the current Ubuntu .deb link, then use wget:
wget -O davmail.deb "PASTE_THE_OFFICIAL_DAVMAIL_DEB_URL_HERE"
Why this matters
The package page lists Debian Linux and Ubuntu as the supported path for Ubuntu installs. Using the official package reduces the risk of tampering and gives you the cleanest integration with the system.
Check the file
ls -lh davmail.deb
You should see a file size that matches a real package download, not a tiny HTML error page.
Step 4: Install DavMail
Now install the package with apt so dependency handling stays simple.
Install the .deb
sudo apt install ./davmail.deb
Why this command is preferred
apt install ./davmail.deb lets apt resolve dependencies automatically. That is better than forcing a low-level dpkg install and then repairing the system afterward.
Expected output
You should see apt unpack the package, configure it, and finish without errors. If Java or another dependency is missing, apt should tell you and try to fix it.
Confirm the install
davmail --version
which davmail
This checks that the command is available in your PATH and that the install finished correctly.
Step 5: Create the DavMail configuration
DavMail will not be useful until you configure its properties file. This is where you tell it which Exchange server to reach, which ports to listen on, and how to handle authentication.
Find the config file
For a user install, DavMail often uses a file in the home directory. For a service-style setup, it is cleaner to use /etc/davmail.properties.
Create the file
sudo nano /etc/davmail.properties
Add the core settings
davmail.server=true
davmail.mode=O365EWS
davmail.authentication=O365Interactive
davmail.url=https://outlook.office365.com/EWS/Exchange.asmx
davmail.caldavPort=1080
davmail.imapPort=1143
davmail.ldapPort=1389
davmail.popPort=1110
davmail.smtpPort=1025
davmail.allowRemote=false
davmail.disableUpdateCheck=true
davmail.logFilePath=/var/log/davmail.log
Why these values matter
davmail.server=true tells DavMail to run without the desktop tray mode, which is better for a server or always-on workstation. The port values are non-privileged, so DavMail can bind without root access. davmail.allowRemote=false keeps the gateway local, which is safer for most users.
Authentication note
If your Microsoft 365 tenant uses MFA or a stricter login policy, you may need a manual or device-based authentication flow instead of a fully interactive one. That choice depends on your tenant rules, not just DavMail itself.
Step 6: Start DavMail manually
Before you build a system service, test the app in the foreground.
Run it once
davmail /etc/davmail.properties
Why this matters
A manual start helps you catch config mistakes early. If DavMail cannot reach Exchange, bind a port, or open the properties file, you will see the error immediately in the terminal.
Expected output
A successful launch usually stays running and produces log messages. If it exits right away, read the error text carefully because it often points to a bad URL, bad auth mode, or a missing port.
Step 7: Set up auto-start with systemd
A systemd service is the right choice if you want DavMail to start at boot and recover after failures. That is the cleanest option for a real Ubuntu 26.04 LTS deployment.
Create a service user
sudo adduser --system --no-create-home --group davmail
This creates a dedicated low-privilege account. That is important because the service should not run as your personal user or as root.
Why this matters
A system user reduces risk. If DavMail ever has a problem, the damage stays limited to the permissions of that account.
Create the service file
sudo nano /etc/systemd/system/davmail.service
Add this content:
[Unit]
Description=DavMail Exchange Gateway
After=network-online.target
[Service]
Type=simple
User=davmail
Group=davmail
ExecStart=/usr/bin/davmail /etc/davmail.properties
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
Why this setup works
After=network-online.target tells systemd to wait until networking is ready. DavMail needs network access immediately, so starting too early can fail. Restart=on-failure helps if the process crashes.
Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable davmail
sudo systemctl start davmail
sudo systemctl status davmail
Why these commands matter
daemon-reload makes systemd read the new unit file. enable turns on boot startup, and start launches the service now. status confirms whether it is healthy.
Step 8: Connect your mail client
Once DavMail is running, your mail app should point to localhost instead of the Exchange server directly.
Thunderbird example
Use these values:
- IMAP server:
127.0.0.1 - IMAP port:
1143 - SMTP server:
127.0.0.1 - SMTP port:
1025 - Encryption: None for local loopback
- Username: your full email address
Why this matters
DavMail is doing the translation work in the background. Your client talks normal IMAP and SMTP to the local gateway, and DavMail handles the Exchange side.
Quick test
Send a test email and refresh the inbox. If the message appears and sending works, the bridge is working.
Step 9: Verify logs and behavior
A sysadmin never trusts a service until the logs agree.
Check systemd logs
sudo journalctl -u davmail -n 50 --no-pager
Why this matters
If DavMail fails during startup, the journal often shows the real reason faster than the app itself. That includes bad auth settings, port conflicts, and network failures.
Check the log file
sudo tail -f /var/log/davmail.log
DavMail can write its own log file too, which helps you follow authentication and sync behavior after startup.
Troubleshooting
Here are the most common issues you may hit during a DavMail on Ubuntu 26.04 setup.
1. DavMail does not start
Cause: Java is missing, the config file is wrong, or the service user cannot read the properties file.
Fix:
java -version
sudo systemctl status davmail
sudo journalctl -u davmail -n 50 --no-pager
Make sure /etc/davmail.properties exists and has the right permissions.
2. Port already in use
Cause: Another process already uses 1143, 1025, or another DavMail port.
Fix:
sudo ss -tlnp | grep -E '1143|1025|1080|1389'
Stop the conflicting service or change the DavMail ports in the properties file.
3. Login or OAuth fails
Cause: The authentication mode does not match your Microsoft tenant rules.
Fix: Try a different DavMail authentication mode that matches your account policy. If MFA is enforced, interactive or device-based login may be needed.
4. Mail client cannot connect
Cause: The client points to the wrong host, wrong port, or SSL settings.
Fix: Make sure the client uses 127.0.0.1 and the local DavMail ports. Do not use external Exchange hostnames in the mail app once DavMail is in place.
5. Service starts, but sync is broken
Cause: The Exchange URL is wrong or the account lacks access.
Fix: Double-check the URL in davmail.url and confirm the mailbox works in a browser.
[su_box title=”VPS Manage Service Offer” style=”bubbles” box_color=”#000000″ radius=”10″]If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal![/su_box]