Context
Recently, I have decided to activate 2FA to my outlook email.
However, due to this 2FA implementation, IMAP cannot access the mail server directly and this incur an error in my PHP script.
As of now the code that I have written to access my outlook with IMAP is simply $mbox = imap_open("{localhost:143}INBOX", "user_id", "password");
Question
Is there any way to bypass this such that when IMAP is reading from the mail server, it does not have to go through any authentication?
Apparently, outlook allows the users to create a password for those applications that do not support 2FA. You can find the reference link here.
However, this means that the site is still not fully secured.