I'm trying to connect to my mailbox with exchangelib. Options are: protocol SMTP, port 465. Code:
credentials = Credentials(MAIL_ACCOUNT, PASS)
config = ExConfiguration(server=MAIL_SERVER + ":" + MAIL_SERVER_PORT, credentials=credentials)
account = Account(MAIL_ACCOUNT,config=config, credentials=credentials, autodiscover=False)
for msg in account.inbox:
print('Message')
Script throws error "exchangelib.errors.TransportError: ('Connection aborted.', BadStatusLine('220 smtp.mydomain.com ESMTP ready'))"
The code 220 means that connection is successful. I believe that there is error due to unexpected string in server response. How can I skip check for this string in response when connecting to server?
exchangelib works with the EWS protocol, not SMTP. You have to either specify the hostname of the server hosting your EWS service, or set up autodiscovery.