We know that IMAP server helps you to sync mail and attachments across platforms. But the right direction is required to perform seamless migration from IMAP server to Office 365. I have an article that helps each level of user to transfer data from IMAP to Microsoft 365 account. You can read and follow the step-by-step procedure to access your mailbox in O365.