all repos — listfix @ eb45395a45d8a9cb7a3af6ecb08d2701a9007cac

Postfix Mailing List Software; Maintained on behalf the of Agency Economy Incorporated NFP.

Check sender instead of From. Its better this way.

	modified:   listfix_filter.py
Brian Barto bartobrian@gmail.com
Tue, 15 Mar 2022 11:30:10 -0400
commit

eb45395a45d8a9cb7a3af6ecb08d2701a9007cac

parent

3769a7afc5c1b226b096dd91e816d9c58a3c0ba1

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M listfix_filter.pylistfix_filter.py

@@ -1,6 +1,8 @@

#!/usr/bin/python3 import sys +import socket +import pwd import os import re

@@ -104,6 +106,9 @@ re_email = re.compile("([^<>\"\s]+)@(\S+\.[^<>\"\s]+)")

re_sender_name = re.compile("^From:\s+\"?([^<>\"]*)\"?\s*<?(\S*)@\S+\.\S+>?$") re_auto_reply = re.compile("^Auto-Submitted: (auto-generated|auto-replied)", re.IGNORECASE) +fqdn = socket.getfqdn() +username = pwd.getpwuid(os.getuid())[0] + sender = None recipient = None to_line = None

@@ -169,7 +174,8 @@ raise ValueError('Can Not Determine Sender Name')

## If this is already filtered, add skip header and resubmit -if (re.search(list_email, from_line)): +listfix_email = f"{username}@{fqdn}" +if (sender == listfix_email): email.insert(0, "Listfix-Skip-Filter: yes\n") send_email(list_email, email) exit()