Home > Enterprise >  About Microsoft turning off IMAP protocol communication. When I use imaplib in python I get this err
About Microsoft turning off IMAP protocol communication. When I use imaplib in python I get this err

Time:10-29

My sample code block;

import imaplib

try:
    userName = "[email protected]"
    passwd = "***"
    SMTP = "outlook.office365.com"
    Port = "993"
    imapSession = imaplib.IMAP4_SSL(SMTP, Port)
    imapSession.login(userName, passwd)
except Exception as e:
    print(e)

Return: error: b'LOGIN failed.'

I'm sure my email and password are correct. Microsoft Office 365 announced that it is shutting down imap protocol communications. How can I do my mail reading operations via office 365?

CodePudding user response:

They are not shitting down IMAP4. They are disabling Basic Authentication - you need to use OAuth.

See https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth

  • Related