"Modern Authentication" for Outlook account on KMail

Hi, I’m trying to use my Outlook (dot) com account on KMail, but I just got an email from Microsoft saying I can’t use basic authentication after September. It says it requires more than just username and password after that point.
I am currently using Debian 12 with Kontact/KMail 5.22.3 (22.12.3).
I think what they want is OAuth. I tried to use the EWS resource but with the EWS URL with outlook (dot) com /EWS/Exchange (dot) asmx . It loads before giving me a 401 error so I cannot get use the EWS method.
Is there some other way I can log in with OAuth2?

As far as I can tell, when Microsoft says “Modern Authentication” they indeed mean XOAUTH2. As per this discussion KMail does not support generic OAuth2 (though I understand it does XOAUTH2 with Gmail), and the relevant ticket to track is probably this: 457233 – Please provide oauth2 login for IMAP - not just Gmail

2 Likes

Currently this is the only thing keeping me from using Kmail. It is a blocking feature for any one using Outlook/Hotmail accounts.

My ¢2 (almost exactly a year later) :

You can use Outlook 365 perfectly. What you need is to install the package kdepim-addons which contains the former akonadi-ews package.

Just use your distro’s package manager. I’m on KDE Neon so that I use apt.

Once this is done, either create a new account or edit the existing one. I did the latter and as it took me a while to figure it all out, I will suggest to just create a new account, go with the basics and then edit it once it’s done.

Once you have your account, go to Settings > Configure Kmail > Accounts or on the sidebar: Right-click on the account and open Account Settings. Then open “Receiving”.

Now open the dropdown “Add” on the right side. There are two options, “Email Account” and “Custom Account”. Chose the latter one. You will see a list of options. Chose “EWS”.

In the tab “General” select “Oauth2”. At this point, you are welcome to yell EUREKA! You can try to discover the server automatically and test it. But this may fail.

If it fails, just enter the URL below manually:

https://outlook.office365.com/EWS/Exchange.asmx

If you test it now, you will be asked to authenticate yourself with whatever method your company has configured (password, OOS, 2FA, etc).

You may need to set configure the other settings such as port and authentication, etc. But if this step is done correctly, you can use the Test Server option. The ports are the usual ones for IMAP (IMAP 993 / SMTP 587). It works well if you set the authentication to PLAIN, but if you ask it to retrieve the information from the server, it will set XAUTH2.

Now prepare to be spammed to death by the KDE notifications :sweat_smile:

As a side note, this is covered here → https://userbase.kde.org/Kmail/Configuring_Kmail/Accounts/Office_365, but it’s missing how to get to this specific point. Not that the documentation is bad, but it assumes that you read it from the start instead of getting there specifically searching for this topic.

To finish everything neatly, remove any previous POP3 / IMAP entry that you may have created for this account. Unless they actually work, of course.

I hope it helps :wink:

Enric

3 Likes

The UI has changed since the guide was made sadly, so I gave up and was finally able to switch back to Thunderbird after rm -rf ~/.thunderbird and sudo dnf install thunderbird, which honestly for me does everything KMail did but better.

I tried switching to KMail as my OS was having problems running Thunderbird for some time before some update patched it. As much as email config is good to understand to be aware of what is happening, Outlook and Gmail integration is really a surprisingly flawless and stress-free out-of-the-box experience, even on Linux! I think for something as basic as email this is important for daily use, making it simple for everyone.

Doing everything on Thunderbird also helps with cross-platform access, as it’s the same app: for example I can run Thunderbird on my Fairphone 5 running Ubuntu Touch and be sure (save a rare device-specific quirk which was happening for some time on my PC) it will work just like it did on my PC.

Also KDE has some pretty complex ways of storing app data (I guess part of better OS integration?), whereas on Thunderbird it’s one .thunderbird file which also saves a lot of pain when trying to debug, backup and restore.

Nevertheless thank you for trying to help, I’m sure KMail and all the efforts behind it will still continue to be useful as libre software despite Thunderbird’s predominance :slight_smile:


yalihupokn@zoqu-endiman:~$ uname -a
Linux zoqu-endiman 6.17.12-400.asahi.fc42.aarch64+16k #1 SMP PREEMPT_DYNAMIC Sun Dec 14 02:20:03 UTC 2025 aarch64 GNU/Linux
yalihupokn@zoqu-endiman:~$ thunderbird --version
Mozilla Thunderbird 146.0.1
yalihupokn@zoqu-endiman:~$