+1 vote

Getting the 'User is authenticated but not connected.' exception on executing the search for the unseen mails in the mail.

I'm using IMAP protocol to search the mails that are unseen, of the office365 outlook mail

the mail is not frequently used mail
verified password once again and the credentials are correct
it's not a shared mailbox


1 Answer

0 votes

This error comes from Office365 server, not Mail.dll itself.

Most likely causes are:

  1. It is a Microsoft's mechanism to shut down chatty clients. The solution would be to login to this account less frequently. (Remember to close the connection properly use Close method and using clause around Imap instance).

  2. It is due to a bug in MS IMAP implementation. If the client presents a valid user name but an invalid password, the server accepts the login, but subsequent commands fail with the aforementioned error message.

  3. It is a shared mailbox and you are using incorrect login scheme. Use Login method and Username@DomainName\SharedMailbox@DomainName for Office365 per: https://www.limilabs.com/blog/shared-mailbox-office365

Some clients report that logging in via web UI / restarting the server help as well.

by (276k points)