Szerintem imap_open-el sehogy, mert ha jól rémlik nem tud oauth-ot. :)
Az MS meg kivezette a simát: :)
Most protocols (Exchange ActiveSync, POP, IMAP, Remote PowerShell, EWS): Basic authentication was largely disabled for these protocols in Exchange Online by October 1, 2022. Microsoft began permanently disabling Basic Auth in all tenants, regardless of usage, around that time.