This page outlines what to do if you set up SMTP with OAuth2 (Microsoft/Azure) and the Authorize button completes successfully, but test emails fail with this error:
Email sending failed: Authentication successful.
Error cause
When you select Authorize, Microsoft's OAuth flow silently authenticates using whichever Microsoft account is already logged in on that browser; it does not always prompt for credentials.
If that account doesn't match the email address configured in your SMTP connector settings, the token doesn't match. Email sending fails even though the authorization itself appears successful. This is easy to miss because KnowledgeOwl displays "Authorization successful" regardless of which account the token was issued for.
This most commonly occurs when you have your own Microsoft account and you're signed into it in the browser, but you're setting up the SMTP connection to use a different or shared email account.
How to resolve the error
The OAuth token was likely issued for the wrong Microsoft account. You need to ensure Microsoft prompts you for credentials when you select Authorize. There are two ways to do this:
- Use an in-private browser session: This option doesn't require you to log out of accounts anywhere. Instead, you'll use a browser session with no cookies so it requires you to log in with the Microsoft account you're setting up the SMTP connection for. Follow the Option 1: Use an in-private browser session instructions.
- Log out of your current Microsoft account first: Forcibly log yourself out of Microsoft before you complete the Authorize step so that you can log in with the Microsoft account you're setting up the SMTP connection for. Follow the Option 2: Log out of your current Microsoft account first instructions.
Option 1: Use an in-private browser session
One of the fastest ways to resolve this is to use your browser's version of a private, in-private, or incognito browser window. This will force you to log into Microsoft freshly:
- Open an in-private or incognito browser window.
- Log in to KnowledgeOwl.
- Go to Account > SMTP.
- Open the details for the SMTP connector you're testing.
- Select Authorize.
- Because no Microsoft account is already logged in, you should be prompted to enter credentials. Enter the username and password for the Microsoft account associated with the email address you're configuring SMTP for, not a personal or admin account.
- You may need to reset the password or configure MFA for this account before logging in.
- Once authorized, send a test email to confirm it works.
Option 2: Log out of your current Microsoft account first
Another option is to log out of Microsoft accounts that aren't associated with the email address you're setting up for SMTP in your current browser session. This should prompt you to log into Microsoft when you attempt to Authorize:
- Head to https://account.microsoft.com.
- Log out of any Microsoft accounts that aren't associated with the email address you're setting up SMTP for.
- In KnowledgeOwl, go to Account > SMTP.
- Open the details for the SMTP connector you're testing.
- Select Authorize.
- Microsoft should now prompt you for credentials.
- Enter the username and password for the correct Microsoft account.
- Once authorized, send a test email to confirm it works.