Using imaplib to access emails in a outlook inbox

Wesley Oliveira 20 Reputation points
2025-01-11T20:57:57.9+00:00

Hi!

I'm trying to retrieve some attachments from my inbox using imaplib with Python to automate the process, but it's not working. I read somewhere that after the deprecation of Basic Authentication, it is no longer possible to access an email inbox using imaplib, and that it can only be done via Microsoft Graph. I wasn't able to find anything about this on the Microsoft forum. Is that true?

Thanks in advance,

Outlook
Outlook
A family of Microsoft email and calendar products.
4,359 questions
0 comments No comments
{count} votes

Accepted answer
  1. SokiGuo-MSFT 29,736 Reputation points Microsoft Vendor
    2025-01-13T05:38:45.5866667+00:00

    Hi @Wesley Oliveira

    Yes. Microsoft has deprecated Basic Authentication for Exchange Online, which includes IMAP, POP, and SMTP protocols. This change took effect on December 31, 2022, and Basic Authentication is no longer supported for accessing email inboxes.

    To access your Outlook inbox using Python, you'll need to use Microsoft Graph API with OAuth 2.0 for authentication. Microsoft Graph provides a more secure and modern way to interact with your email data. More information, see: https://learn.microsoft.com/en-us/exchange/clients-and-mobile-in-exchange-online/deprecation-of-basic-authentication-exchange-online.

    By the way, the Outlook tab focuses on solving problems with the Outlook desktop client. If you have any questions about Graph, please consider getting more professional advice under this Microsoft Graph tab.

    Thank you for your understanding and support!

     


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.