0

I am trying to connect to my outlook email using

import imapclient                                                        
server = imapclient.IMAPClient('imap-mail.outlook.com', ssl=True)        
server.login('myemail',password)                                 
import pprint                                                            
pprint.pprint(server.list_folders())                                     
server.select_folder('Inbox')

and i am met with the error

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

I find it odd because the same code works on my personal computer (Mac) when I connect to my personal email (Outlook). But when I try the same code on my work computer (Windows) I can't connect to my work email (Outlook).

Any help would be greatly appreciated.

Thanks

currenseeds
  • 1
  • 1
  • 1

1 Answers1

0

Here I also had a similr requirement of connecting to Outlook email from windows laptop using python.

I used a library called exchangelib ( https://pypi.org/project/exchangelib/ )

Here is the full code with step by step explanation - works just fine on windows

https://medium.com/@theamazingexposure/accessing-shared-mailbox-using-exchangelib-python-f020e71a96ab