From 8e408554d5d0e628f4e1ff4e2be6092abc9d88d4 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Wed, 24 Jul 2024 10:56:02 +0800 Subject: [PATCH] fix: some email not forwarded --- main.py | 5 ++--- template.html | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index cfe3b07..b2e76ae 100644 --- a/main.py +++ b/main.py @@ -26,7 +26,7 @@ def add_mask(original_msg, content): from_name = decode_mime_words(from_name) to_name, to_address = parseaddr(original_msg['To']) to_name = decode_mime_words(to_name) - header = f"""
Forwarded Email

From: {from_name} <{from_address}>

To: {to_name} <{to_address}>

Subject: {original_subject}

""" + header = f"""
Forwarded Email

From: {from_name} <{from_address}>

To: {to_name} <{to_address}>

Subject: {original_subject}

""" footer = f"""
FORWARDED

Notice:

 This is a automatically forwarded email, which means it may contains something bad.

 You shouldn't reply directly to this email, it will never reach your destination!

""" return header + content + footer @@ -81,8 +81,7 @@ def get_unforwarded_emails(account_config, logger): for response_part in data: if isinstance(response_part, tuple): msg = email.message_from_bytes(response_part[1]) - if 'Forwarded' not in msg['Subject']: - emails.append((email_id, msg)) + emails.append((email_id, msg)) imap.logout() if len(emails) > 0: logger.info(f"Retrieved {len(emails)} new emails from {account_config['email']}") diff --git a/template.html b/template.html index 21f9b2e..c6b276e 100644 --- a/template.html +++ b/template.html @@ -1,5 +1,4 @@