email_requests: Catch all connection related exceptions

Closes: #4160
Closes: #4105
This commit is contained in:
Johann Bauer 2018-03-23 15:17:31 +01:00
parent ba658180d9
commit 8f31d224aa
No known key found for this signature in database
GPG key ID: 84F1BF925B1F484D

View file

@ -87,7 +87,7 @@ class Processor(threading.Thread, PrintError):
try:
self.M = imaplib.IMAP4_SSL(self.imap_server)
self.M.login(self.username, self.password)
except imaplib.IMAP4.error as e:
except BaseException as e:
self.print_error(e)
self.connect_wait *= 2
# Reconnect when host changes
@ -111,7 +111,7 @@ class Processor(threading.Thread, PrintError):
s.login(self.username, self.password)
s.sendmail(self.username, [recipient], msg.as_string())
s.quit()
except smtplib.SMTPException as e:
except BaseException as e:
self.print_error(e)