Closed lucasnad27 closed 7 months ago
This would only make sense, I think, if an INBOX couldn't be found. Do you have a protocol log that I could take a look at?
@jstedfast not yet on the protocol log. going to work on putting that together, but need to spent a bit of time getting the app running locally, as it usually runs as an Azure function.
fwiw - I can access these users' inbox (they are technically a "shared" inbox in MS Outlook) from my own outlook account, which has access -- my current working theory is that Inbox is null because of a silent permissions issue 🤷🏻♂️ -- hopefully that protocol log will give some additional hints.
One other piece of information, I tried Getting the first folder in the personal namespace, as shown below. That throws an index error, indicating that PersonalNamespaces is an empty list.
emailClient.GetFolder(emailClient.PersonalNamespaces[0]);
Working on that protocol log today.
That suggests to me that probably a NAMESPACE
command failed. That's probably also why Inbox is null.
Hey @jstedfast I found a workaround for this authentication issue. Not pretty but it's going to do the job for now. I'm still actively engaged with MS support to track down the root cause. I will follow up on this ticket when I have more info -- in case it's helpful for error handling in Mailkit. Feel free to keep this issue open or closed in the meantime. Thanks for your quick responses on this 🙏🏻
Is this one of those Exchange authentication issues where it says "User authenticated but not connected"?
I haven't seen that anywhere in my logs. I do know that the imapClient.IsConnected
property returns true.
It reports true in the case I mentioned as well because there is a connection.
The problem I mentioned is Exchange thinking that there is no connection. It's a very bizarre error that I think (if my memory is correct), it has something to do with the user's Office365 settings not allowing IMAP connections, but the correct OAuth2 credentials were supplied in the AUTH command.
This results in Exchange getting confused and returning all sorts of errors to various commands like NAMESPACE.
Here's an example: https://github.com/jstedfast/MailKit/issues/1494
StackOverflow has a number of these as well, but no logs that I saw in the first few clicks
https://stackoverflow.com/search?q=%5Bimap%5D%5Boffice365%5D+authenticated+but+not+connected
Since you are in direct communication with the MS Support, I'm going to close this because I'm 99% sure this is an Exchange issue (or a Office365 permissions issue).
I'll still be listening for notifications on this thread if there is anything you find out and if it is a MailKit issue, I'll reopen it (or you can reopen it).
The MS Support people are probably in a better position to help you at this point.
Describe the bug I'm using the SaslMechanismOAuth2 to connect to an instance of
ImapClient
. This code works for a majority of the email inboxes I'm connected to, but a couple of days ago, ~8 email clients started returningnull
when accessing theInbox
. More details below...Platform
4.8
2.0.6
Exception If you got an exception, please include the exception Message and StackTrace. Nothing really helpful -- the stack trace I have is a null pointer exception encountered when calling
GetSubfolders
on theInbox
because it's returning null (see code example below)To Reproduce Steps to reproduce the behavior: Because of the nature of this bug, I don't have any great reproduction steps, but I've provided some sample code below..
Expected behavior It should connect to the the user's Inbox and be able to access all subfolders when calling the
GetSubfolders
method.Code Snippets
Protocol Logs Please include a protocol log (scrubbed of any authentication data), especially if you got an exception such as
Syntax error in XYZ. Unexpected token: ...
.NOTE: Working on getting logs prepped to ship
To get a protocol log, follow one of the following code snippets:
Note: if the protocol log contains sensitive information, feel free to email it to me at jestedfa@microsoft.com instead of including it in the GitHub issue.
Additional context Add any other context about the problem here.
A few things that have helped me while debugging:
IsAuthenticated
andIsConnected
properties and both return true, but still returns a nullInbox