fixed open outlook.office386.com with ssl

This commit is contained in:
2023-07-19 15:33:49 +02:00
parent 35c06a9c5e
commit 240684b574
3 changed files with 9 additions and 8 deletions

View File

@@ -110,10 +110,8 @@ def mailbox_connect(request, societe):
request.session.flash("ERREUR de connexion au serveur Exchange : %s" % result.get("error"), 'danger')
return None
imap = imaplib.IMAP4('outlook.office365.com')
imap.starttls()
# import pdb;pdb.set_trace()
try:
imap = imaplib.IMAP4_SSL('outlook.office365.com', 993)
# se connecter à la mailbox
imap.authenticate("XOAUTH2", lambda x: generate_auth_string(mbx_name, result['access_token']).encode("utf-8"))
except imaplib.IMAP4.error: