Using Thunderbird with Outlook email
2022 July 17
2022 August 28 Update: I just learned I can do this without davmail by just setting the authentication method to OAuth2. See How to Configure Thunderbird for Office 365 Using IMAP (Oauth2).
Two days ago, I wrote about setting up Evolution with my school email because I couldn't figure out how to get Thunderbird working.
Today, I figured out how to get Thunderbird working.
In this setup, Thunderbird connects to davmail (running locally, though I'd like to set it up on my server at some point), which in turn connects to Microsoft Outlook.
1. Install Thunderbird and davmail
Unfortunately, davmail is not available in the Fedora repos, so I set it up on Debian:
sudo apt install thunderbird davmail
2. Set up Thunderbird with davmail
When you first run davmail, it will launch a menu like the one below.
Change the Exchange Protocol to O365Interactive. If you don't do this, davmail will be unable to authenticate with 2FA.
Save this change.
Now, open Thunderbird. On first run, Thunderbird should ask you to set up an existing email address.
Fill in your information.
Click Configure manually.
Scroll down and fill in the information for the davmail bridge.
If you didn't change anything, the incoming server will be:
- Protocol: IMAP
- Hostname: localhost
- Port: 1143
Again, if you didn't change anything, the outgoing server should be:
- Hostname: localhost
- Port: 1025
Click Re-test to check these settings and get defaults from the bridge.
Click Done to attempt to log in.
Since we're making an unencrypted connection, Thunderbird will throw a warning.
This is fine since we're just connecting on localhost (i.e., not sending data over a network). If you're running davmail on a server, make sure to change this setup accordingly.
Check the I understand the risks box and click Confirm.
davmail will now open a dialog asking the user to authenticate with Office. Click the link to open it in your browser.
Sign in to your Microsoft account.
My school required Duo authentication as well.
If this is your first time connecting davmail to your account, Microsoft will ask if you want to grant permission for it to act as a third-party app. Accept this request.
You will be redirected to a blank page. Copy the URL. It contains the OAuth2 code needed for davmail to authenticate.
Paste this URL into the davmail window and click OK.
Go back to Thunderbird and click Done again to try to log in.
This time, you should log in successfully.