Are there solutions to bypass Outlook authorization with PHP and IMAP?


I recently decided to implement a 2FA in my Outlook email that I used in my PHP script with IMAP ().

However, due to this 2FA implementation, IMAP cannot directly access the mail server and this leads to an error in my script.

As of now, the code I wrote to access my Outlook using IMAP is simple $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");


Is there a way to work around this so that IMAP does not have to go through any authentication when reading from the mail server?