fixing shutdown when exim4 is not set up

master
b3yond 2019-01-11 14:52:58 +01:00
parent 6d94c1b540
commit 3590aa67a3
1 changed files with 5 additions and 1 deletions

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():