From c9d5f7441ad015ee1ace8712c4609b08e257e73f Mon Sep 17 00:00:00 2001 From: b3yond Date: Tue, 23 Jan 2018 09:17:26 +0100 Subject: [PATCH] excepted IMAP4 error with unknown cause --- mailbot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mailbot.py b/mailbot.py index a513359..d74e3b8 100644 --- a/mailbot.py +++ b/mailbot.py @@ -70,7 +70,11 @@ class Mailbot(object): crawl for new mails. :return: msgs: (list of report.Report objects) """ - rv, data = self.mailbox.select("Inbox") + try: + rv, data = self.mailbox.select("Inbox") + except imaplib.IMAP4.abort: + logger.error("Crawling Mail failed", exc_info=True) + rv = False msgs = [] if rv == 'OK': rv, data = self.mailbox.search(None, "ALL")