You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
After connecting and authenticating an ImapClient pointing to a different mailbox, the Inbox property can return null.
The protocol log shows "User is authenticated but not connected".
After signing in to Office365 with the same credentials, it appears the problem occurs when the user has no permission to access the mailbox.
Platform (please complete the following information):
OS: Windows Server 2016 (1607)
.NET Framework: .NET 4.8
MailKit Version: 2.10.1
To Reproduce
using var client = new ImapClient(new ProtocolLogger("imap.log"));
await client.ConnectAsync("outlook.office365.com", 993, SecureSocketOptions.Auto, cancellationToken);
await client.AuthenticateAsync(new NetworkCredential(@"user@domain.com\mailbox", "password"), cancellationToken);
if (client.Inbox is null) throw new InvalidOperationException("Inbox not found!");
Expected behavior
I'm not too sure here. Obviously it would be better if the authenticate call would fail with an exception, since the user has no access to the mailbox. But it appears that the login completes OK.
Perhaps the Inbox property should throw an exception? I'm assuming the NAMESPACE command is issued when this property is accessed.
Protocol log
Connected to imaps://outlook.office365.com:993/
S: * OK The Microsoft Exchange IMAP4 service is ready. [QQBNAD...]
C: J00000000 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
S: J00000000 OK CAPABILITY completed.
C: J00000001 AUTHENTICATE PLAIN AHVzZXJAZG9tYWluLmNvbVxtYWlsYm94AHBhc3N3b3Jk
S: J00000001 NO AUTHENTICATE failed.
C: J00000002 LOGIN "user@domain.com\\mailbox" password
S: J00000002 OK LOGIN completed.
C: J00000003 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+
S: J00000003 OK CAPABILITY completed.
C: J00000004 NAMESPACE
S: J00000004 BAD User is authenticated but not connected.
C: J00000005 LIST "" "INBOX"
S: J00000005 BAD User is authenticated but not connected.
S: * BYE Connection closed. 14
(Credentials obfuscated on both AUTHENTICATE and LOGIN lines.)
The text was updated successfully, but these errors were encountered:
Description
After connecting and authenticating an
ImapClient
pointing to a different mailbox, theInbox
property can returnnull
.The protocol log shows "User is authenticated but not connected".
After signing in to Office365 with the same credentials, it appears the problem occurs when the user has no permission to access the mailbox.
Platform (please complete the following information):
To Reproduce
Expected behavior
I'm not too sure here. Obviously it would be better if the authenticate call would fail with an exception, since the user has no access to the mailbox. But it appears that the login completes OK.
Perhaps the
Inbox
property should throw an exception? I'm assuming theNAMESPACE
command is issued when this property is accessed.Protocol log
(Credentials obfuscated on both
AUTHENTICATE
andLOGIN
lines.)The text was updated successfully, but these errors were encountered: