Office 365 and IMAP or POP3 with OAuth 2.0 authentication in unattended (app-only) mode: How to make it work
App-only authentication is used for services/daemons with no singed-in user present. This step-by-step guide shows how to make it work with Rebex IMAP or POP3.