Credits to PixlOne for O365Interactive mode and headless Davmail
Step 1: Get Davmail.
- I'm on Arch Linux, so I installed it from the AUR.
- Use O365Interactive for Protocol, and uncheck
Local POP port
,Caldav HTTP port
, andLocal LDAP port
. Keep everything else as the default, and hit save.
- I'm using Mailspring, which I believe is the best mail client I can get for free. [Not Sponsored]
- Use manual config (IMAP/SMTP) to setup the account.
- Use
<your WatIAM username>@uwaterloo.ca
as your username and your WatIAM password. - Use
localhost
as the server. - Use the ports set in Davmail (1143 for IMAP and 1025 for SMTP by default).
- Set any authentication to None.
- The first time you attempt to connect, you'll get a Davmail popup and the UWaterloo adfs page will open. Login with your credentials, and paste the link you reach at the end into the Davmail prompt.
- Success! Your mail should now work. Davmail basically acts as an interpreter between the O365/Exchange network and IMAP/SMTP. As such, it must be constantly running to receive/send mail. Go ahead and exit Davmail. Copy the properties from your home directory to
/etc
with:
sudo cp ~/.davmail.properties /etc/davmail/<your-linux-username>.properties
and change O365Interactive
to O365Manual
in the config file:
sed -i 's/O365Interactive/O365Manual/g'
- Add a davmail user:
sudo useradd --system davmail
- Finally, start and enable the service with:
sudo systemctl enable --now davmail@<your-linux-username>
That's it! Note: Always test and verify via the webapp before relying on any setup!
[email protected] - DavMail for obaranek
Loaded: loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
Active: active (running) since Mon 2021-02-22 12:14:36 EST; 1h 14min ago
Main PID: 250785 (java)
Tasks: 26 (limit: 18757)
Memory: 39.6M
CGroup: /system.slice/system-davmail.slice/[email protected]
└─250785 /bin/java -jar /usr/share/java/davmail/davmail.jar /etc/davmail/obaranek.properties
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,325 ERROR [main] davmail - Unable to create log file directory
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,325 ERROR [main] davmail - Unable to set log file path
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,354 DEBUG [main] davmail.DavGateway - Headless mode, do not create GUI
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,355 ERROR [main] davmail - Unable to set log file path
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,355 DEBUG [main] davmail.DavGateway - Start DavMail in server mode
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,384 INFO [main] davmail - DavMail Gateway 5.5.1-3299 listening on POP port 1110 CALDAV port 1080 LDAP port 1389
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,385 ERROR [main] davmail - Unable to bind server socket for SMTP on port 1025: port not allowed or in use by another process
Feb 22 12:14:36 arch davmail[250785]: Unable to bind server socket for IMAP on port 1143: port not allowed or in use by another process
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,436 DEBUG [CheckRelease] davmail.http.HttpClientAdapter - GET http://davmail.sourceforge.net/version.txt
Feb 22 12:14:36 arch davmail[250785]: 2021-02-22 12:14:36,686 DEBUG [CheckRelease] davmail.DavGateway - DavMail released version: 5.5.1-3299