fixing shutdown when exim4 is not set up

This commit is contained in:
b3yond 2019-01-11 14:52:58 +01:00
parent 8e1234d9b5
commit 4b8798ddea

View file

@ -19,7 +19,11 @@ class Mailbot(Bot):
def crawl(self, user):
reports = []
# todo: adjust to actual mailbox
mails = mailbox.mbox("/var/mail/" + config['mail']['mbox_user'])
try:
mails = mailbox.mbox("/var/mail/" + config['mail']['mbox_user'])
except FileNotFoundError:
logger.error("No mbox file found.", exc_info=True)
return reports
for msg in mails:
if get_date_from_header(msg['Date']) > user.get_seen_mail():
if user.get_city().lower() in msg['To'].lower():