Adding office365 smtp to existing account

Hey, I have some issues pairing different accounts. My main account is a normal IMAP with some external provider. I would like to use the account (non-office365), but send emails using another office365 SMTP server, because our company uses it.

Initially, I tried integrating the office365 identity into the main account on the provider’s webinterface (via something they call “Identities for Aliases”), which kinda worked for using the main account’s smtp to send under office365 identity, but the emails still get flagged as spam. (this part is unrelated to k-9)

Now to K-9.
My next approach was to add the office365 SMTP to my main imap account for sending. However, this does not work for some reason. When i try to add it, instead of opening a OAuth2 window, I just get an error: Setup could not finish. OAuth 2.0 is currently not supported with this provider.

However, after playing around with it, I found a workaround. When I remove all accounts and add the office365 account (with imap and smpt), then i get the OAuth. After the account is properly integrate into K-9, I can change the “Fetching mail” settings again to point to my other IMAP provider.

Is this behavior expected or a bug?

Also, after i had set up the working config, I exported the settings to file. But when i try to import this file the account is not working again with the following error when hitting the sign-in button: “OAuth 2.0 is currently not supported with this provider.”

Best regards.

Have you looked at the instructions for adding an Office365 account?

1 Like

Yes, that work as I have outlined in my error report. But that’s not the point. The issue is that I cannot mix non-office365 imap with office365 smtp. It either results in setup errors or config export errors.

This is currently not supported. I’ve created an issue for this bug: Can't use OAuth2 with just the outgoing server · Issue #6501 · thundernest/k-9 · GitHub

Your workaround uses an implementation detail to make things work. You will probably end up with the original error message if you ever have to re-authorize the app when the OAuth token can’t be refreshed for whatever reason.