Hi @YiboLiu,
Welcome to Microsoft Q&A, and thank you so much for reaching out to us.
Please note that our forum is a public platform, and we will modify your question to hide your personal information in the description. Kindly ensure that you hide any personal or organizational information the next time you post an error or other details to protect personal data.
Please note that as a Microsoft Q&A moderator, I do not have access to your specific configuration, and my testing environment is limited. However, I’ll do my best to assist you.
Based on your description, your email appears to be a personal Outlook.com account, and the IMAP server you’re using is incorrect. For personal accounts, the correct IMAP server is: imap-mail.outlook.com
For more information, you can check on this Microsoft Article here.
Additionally, please be aware that Microsoft has disabled Basic Authentication (username/password) for IMAP, POP, and SMTP across both enterprise and consumer services.
If you want to programmatically log in to your account, the recommended approach is to register your app in Azure or Entra and obtain an OAuth 2.0 access token scoped for IMAP/SMTP. This ensures compliance with modern authentication requirements and security best practices.
For more information, you can check out this Microsoft Article here.
I hope this help.
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.