浏览代码

handle the case some email providers might strip off the = suffix

Son NK 5 年之前
父节点
当前提交
0f71eff531
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      email_handler.py

+ 7 - 1
email_handler.py

@@ -749,7 +749,13 @@ def handle_unsubscribe(envelope: Envelope):
     # format: alias_id:
     subject = msg["Subject"]
     try:
-        alias_id = int(subject[:-1])
+        # subject has the format {alias.id}=
+        if subject.endswith("="):
+            alias_id = int(subject[:-1])
+        # some email providers might strip off the = suffix
+        else:
+            alias_id = int(subject)
+
         alias = Alias.get(alias_id)
     except Exception:
         LOG.warning("Cannot parse alias from subject %s", msg["Subject"])