diff options
author | Mark Sapiro <mark@msapiro.net> | 2014-04-23 20:30:50 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2014-04-23 20:30:50 -0700 |
commit | e700b13082fa55f9172c04fba6366a4a3e859ff5 (patch) | |
tree | affb5438f9fa2dc72e3aaba9bf79f4ea49dbae18 /Mailman/Handlers/WrapMessage.py | |
parent | ec813e77dcffc14e02331ecd65d5e3f6b7019ad5 (diff) | |
download | mailman2-e700b13082fa55f9172c04fba6366a4a3e859ff5.tar.gz mailman2-e700b13082fa55f9172c04fba6366a4a3e859ff5.tar.xz mailman2-e700b13082fa55f9172c04fba6366a4a3e859ff5.zip |
Fixed the Munge From action to not actually Munge the From: or Reply-To:
until after the message has been sent to the archive, digest and usenet
gateway.
Diffstat (limited to 'Mailman/Handlers/WrapMessage.py')
-rw-r--r-- | Mailman/Handlers/WrapMessage.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Mailman/Handlers/WrapMessage.py b/Mailman/Handlers/WrapMessage.py index de981dd6..d9f4e04a 100644 --- a/Mailman/Handlers/WrapMessage.py +++ b/Mailman/Handlers/WrapMessage.py @@ -17,6 +17,9 @@ """Wrap the message in an outer message/rfc822 part and transfer/add some headers from the original. + +Also, in the case of Munge From, replace the From: and Reply-To: in the +original message. """ import copy @@ -35,8 +38,22 @@ KEEPERS = ('to', def process(mlist, msg, msgdata): + # This is the negation of we're wrapping because dmarc_moderation_action + # is wrap this message or from_is_list applies and is wrap. if not (msgdata.get('from_is_list') == 2 or (mlist.from_is_list == 2 and msgdata.get('from_is_list') == 0)): + # Now see if we're munging. + if msgdata.get('from_is_list') == 1 or (mlist.from_is_list == 1 and + msgdata.get('from_is_list') == 0): + # Yes. + a_h = msgdata.get('add_header') + if a_h: + if a_h.get('From'): + del msg['from'] + msg['From'] = a_h.get('From') + if a_h.get('Reply-To'): + del msg['reply-to'] + msg['Reply-To'] = a_h.get('Reply-To') return # There are various headers in msg that we don't want, so we basically |