mailbot doesn't crawl mails which it wrote itself anymore

This commit is contained in:
b3yond 2018-01-18 14:23:11 +01:00
parent 331bf6277e
commit 95466c5cc3
1 changed files with 12 additions and 9 deletions

View File

@ -84,6 +84,8 @@ class Mailbot(object):
return msgs return msgs
msg = email.message_from_bytes(data[0][1]) msg = email.message_from_bytes(data[0][1])
if not self.config['mail']['user'] + "@" + \
self.config["mail"]["mailserver"].partition(".")[2] in msg['From']:
# get a comparable date out of the email # get a comparable date out of the email
date_tuple = email.utils.parsedate_tz(msg['Date']) date_tuple = email.utils.parsedate_tz(msg['Date'])
date_tuple = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple)) date_tuple = datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple))
@ -154,7 +156,8 @@ class Mailbot(object):
:param statuses: (list of report.Report objects) :param statuses: (list of report.Report objects)
:return: statuses: (list of report.Report objects) :return: statuses: (list of report.Report objects)
""" """
self.post(statuses) for status in statuses:
self.post(status)
msgs = self.crawl() msgs = self.crawl()