diff options
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Handlers/SpamDetect.py | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/Mailman/Handlers/SpamDetect.py b/Mailman/Handlers/SpamDetect.py index 85d8af58..119c5beb 100644 --- a/Mailman/Handlers/SpamDetect.py +++ b/Mailman/Handlers/SpamDetect.py @@ -87,30 +87,33 @@ def process(mlist, msg, msgdata): # Before anything else, check DMARC if necessary. We do this as early # as possible so reject/discard actions trump other holds/approvals and # wrap/munge actions get flagged even for approved messages. - msgdata['from_is_list'] = 0 - dn, addr = parseaddr(msg.get('from')) - if addr and mlist.dmarc_moderation_action > 0: - if Utils.IsDMARCProhibited(mlist, addr): - # Note that for dmarc_moderation_action, 0 = Accept, - # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard - if mlist.dmarc_moderation_action == 1: - msgdata['from_is_list'] = 1 - elif mlist.dmarc_moderation_action == 2: - msgdata['from_is_list'] = 2 - elif mlist.dmarc_moderation_action == 3: - # Reject - text = mlist.dmarc_moderation_notice - if text: - text = Utils.wrap(text) - else: - text = Utils.wrap(_( + # But not for owner mail which should not be subject to DMARC reject or + # discard actions. + if not msgdata.get('toowner'): + msgdata['from_is_list'] = 0 + dn, addr = parseaddr(msg.get('from')) + if addr and mlist.dmarc_moderation_action > 0: + if Utils.IsDMARCProhibited(mlist, addr): + # Note that for dmarc_moderation_action, 0 = Accept, + # 1 = Munge, 2 = Wrap, 3 = Reject, 4 = Discard + if mlist.dmarc_moderation_action == 1: + msgdata['from_is_list'] = 1 + elif mlist.dmarc_moderation_action == 2: + msgdata['from_is_list'] = 2 + elif mlist.dmarc_moderation_action == 3: + # Reject + text = mlist.dmarc_moderation_notice + if text: + text = Utils.wrap(text) + else: + text = Utils.wrap(_( """You are not allowed to post to this mailing list From: a domain which publishes a DMARC policy of reject or quarantine, and your message has been automatically rejected. If you think that your messages are being rejected in error, contact the mailing list owner at %(listowner)s.""")) - raise Errors.RejectMessage, text - elif mlist.dmarc_moderation_action == 4: - raise Errors.DiscardMessage + raise Errors.RejectMessage, text + elif mlist.dmarc_moderation_action == 4: + raise Errors.DiscardMessage if msgdata.get('approved'): return # First do site hard coded header spam checks |