Merge pull request #33164 from sokumon/handle-logout

fix: handle abort while logout
This commit is contained in:
Soham Kulkarni 2025-06-30 17:34:24 +05:30 committed by GitHub
commit baca028f83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -162,10 +162,14 @@ class EmailServer:
return res[0] == "OK" # The folder exists TODO: handle other responses too
def logout(self):
if cint(self.settings.use_imap):
self.imap.logout()
else:
self.pop.quit()
try:
if cint(self.settings.use_imap):
self.imap.logout()
else:
self.pop.quit()
except imaplib.IMAP4.abort:
self.connect()
self.logout()
return
def get_messages(self, folder="INBOX"):