summaryrefslogtreecommitdiff
path: root/emailcanary/canary.py
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2022-04-30 10:34:53 -0700
committerJesse Morgan <jesse@jesterpm.net>2022-04-30 10:34:53 -0700
commit04905ba6d973a57c9d37bb75ee376c896a47ac5d (patch)
treecb56c09e7c055c9656c6ea3d25f5ea8eb147072a /emailcanary/canary.py
parente88bebbf326baabb26dff0b5a69cae3b91e925bd (diff)
Migrate to python3
Diffstat (limited to 'emailcanary/canary.py')
-rw-r--r--emailcanary/canary.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/emailcanary/canary.py b/emailcanary/canary.py
index aac6418..cfac01b 100644
--- a/emailcanary/canary.py
+++ b/emailcanary/canary.py
@@ -1,6 +1,7 @@
import uuid, datetime, time
-import email.message, emailutils
+import email.message
import re
+from . import emailutils
class Canary:
def __init__(self, db, smtp, fromaddress):
@@ -30,13 +31,13 @@ class Canary:
these_subjects = []
for uid in emailutils.get_mail_uids(mail):
message = emailutils.get_message(mail, uid)
- if self.processMessage(address, message):
+ if message is not None and self.processMessage(address, message):
emailutils.delete_message(mail, uid)
emailutils.close(mail)
return self.db.get_missing_pongs(listAddress)
def processMessage(self, receipient, msg):
- match = re.match('.*Canary Email (.+)', msg['Subject'])
+ match = re.match('.*Canary Email (.+)', str(msg['Subject']))
if match:
chirpUUID = match.group(1)
now = datetime.datetime.now()