fix: RFC822 From and To

This commit is contained in:
Zichao Lin 2024-07-24 16:07:24 +08:00
parent 993ca50352
commit e54d35a9d7
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -115,11 +115,8 @@ def forward_emails(account_config, emails, logger):
to_name, to_address = parseaddr(original_msg['To'])
to_name = decode_mime_words(to_name)
msg = MIMEMultipart('mixed')
if provider_in(account_config['email'], ["yandex.com", "mail.ru", "internet.ru", "bk.ru", "inbox.ru", "list.ru"]):
msg['From'] = f"Forwarder <{account_config['email']}>"
else:
msg['From'] = f"{from_name} ({from_address}) via Forwarder <{account_config['email']}>"
msg['To'] = f"{to_name} ({to_address}) via Forwarder <{recipient}>"
msg['From'] = f'"{from_name} ({from_address}) via Forwarder" <{account_config["email"]}>'
msg['To'] = f'"{to_name} ({to_address}) via Forwarder" <{recipient}>'
original_subject = decode_mime_words(original_msg['Subject'])
msg['Subject'] = original_subject