Browse Source

force convert header to string if needed

Son NK 5 năm trước cách đây
mục cha
commit
c36870daa8
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      email_handler.py

+ 3 - 2
email_handler.py

@@ -305,9 +305,10 @@ def generate_reply_email():
 def should_append_alias(msg: Message, address: str):
     """whether an alias should be appended to TO header in message"""
 
-    if msg["To"] and address.lower() in msg["To"].lower():
+    # # force convert header to string, sometimes addrs is Header object
+    if msg["To"] and address.lower() in str(msg["To"]).lower():
         return False
-    if msg["Cc"] and address.lower() in msg["Cc"].lower():
+    if msg["Cc"] and address.lower() in str(msg["Cc"]).lower():
         return False
 
     return True