Exchange: ErrorNamespace

Still an issue years later, I’m starting to wonder if this app is still in active development.

'----------IMAP----------\n' +
    'connect <mailcore::IMAPSession:0x7ffd067dbed0>\r\n' +
    '* OK The Microsoft Exchange IMAP4 service is ready. [QgBOADAAUABSADAAMwBDAEEAMAAwADIAOAAuAG4AYQBtAHAAcgBkADAAMwAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]\r\n' +
    'ssl connect outlook.office365.com 993 2\r\n' +
    'OpenSSL version: OpenSSL 1.1.0f  25 May 2017\r\n' +
    '1 CAPABILITY\r\n' +
    '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+\r\n' +
    '1 OK CAPABILITY completed.\r\n' +
    'connect ok\r\n' +
    'login\r\n' +
    '2 AUTHENTICATE XOAUTH2 
    '2 OK AUTHENTICATE completed.\r\n' +
    '3 CAPABILITY\r\n' +
    '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+\r\n' +
    '3 OK CAPABILITY completed.\r\n' +
    '4 NAMESPACE\r\n' +
    '4 BAD User is authenticated but not connected.\r\n' +
    'fetch namespace failed\r\n'

SIMPLE RESOLUTION (For Outlook accounts at least)
TLDR - Go to your outlook account via browser and open your settings and under MAIL - FORWARDING AND IMAP scroll to the bottom and check let devices and apps use IMAP.

I ran into the same issue - now in 2025. Don’t know if anyone still uses MailSpring (Really dont like Thunderbird - trying Mailspring now. If anyone has better option than MS for Linux/Ubuntu let me know. Something with a modern ui). I was trying to connect a outlook account that was created very recently - within the year 2025.

The overall issue seems to be that microsoft has disabled/reduced the use of IMAP as a valid resource/login for user accounts created around and after 2021. I had no problem connecting an outlook account that was created pre-2019.

I was able to work around this issue by visiting my outlook settings for the newer account. The menu option Forwarding and IMAP had an option to allow IMAP connections. When I tried to connect Mailbird to the account after making that change, it connected successfully. Hope this helps someone!