in reply to 365 E-Mail

It's not (yet) IMAP access, but App::wsgetmail shows how to set up an application to authenticate with Office 365. You will likely have to adapt the authentication there and then maybe use that authentication token in connection with your IMAP client.

I have not done any of this, but this is where I would start.