summaryrefslogtreecommitdiff
path: root/src/mailman
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman')
-rw-r--r--src/mailman/queue/bounce.py34
-rw-r--r--src/mailman/queue/maildir.py4
2 files changed, 4 insertions, 34 deletions
diff --git a/src/mailman/queue/bounce.py b/src/mailman/queue/bounce.py
index 0b8e2df88..d6b1576a2 100644
--- a/src/mailman/queue/bounce.py
+++ b/src/mailman/queue/bounce.py
@@ -26,6 +26,7 @@ import datetime
from email.utils import parseaddr
from lazr.config import as_timedelta
+from mailman.app.bounces import get_verp
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.bounce import Stop
@@ -189,7 +190,7 @@ class BounceRunner(Runner, BounceMixin):
if not mlist.bounce_processing:
return
# Try VERP detection first, since it's quick and easy
- addrs = verp_bounce(mlist, msg)
+ addrs = get_verp(mlist, msg)
if addrs:
# We have an address, but check if the message is non-fatal.
if scan_messages(mlist, msg) is Stop:
@@ -227,37 +228,6 @@ class BounceRunner(Runner, BounceMixin):
-def verp_bounce(mlist, msg):
- bmailbox, bdomain = split_email(mlist.GetBouncesEmail())
- # Sadly not every MTA bounces VERP messages correctly, or consistently.
- # Fall back to Delivered-To: (Postfix), Envelope-To: (Exim) and
- # Apparently-To:, and then short-circuit if we still don't have anything
- # to work with. Note that there can be multiple Delivered-To: headers so
- # we need to search them all (and we don't worry about false positives for
- # forwarded email, because only one should match VERP_REGEXP).
- vals = []
- for header in ('to', 'delivered-to', 'envelope-to', 'apparently-to'):
- vals.extend(msg.get_all(header, []))
- for field in vals:
- to = parseaddr(field)[1]
- if not to:
- continue # empty header
- mo = re.search(config.mta.verp_regexp, to)
- if not mo:
- continue # no match of regexp
- try:
- if bmailbox <> mo.group('bounces'):
- continue # not a bounce to our list
- # All is good
- addr = '%s@%s' % mo.group('mailbox', 'host')
- except IndexError:
- elog.error("verp_regexp doesn't yield the right match groups: %s",
- config.mta.verp_regexp)
- return []
- return [addr]
-
-
-
def verp_probe(mlist, msg):
bmailbox, bdomain = split_email(mlist.GetBouncesEmail())
# Sadly not every MTA bounces VERP messages correctly, or consistently.
diff --git a/src/mailman/queue/maildir.py b/src/mailman/queue/maildir.py
index fe4dc9da1..07a89903c 100644
--- a/src/mailman/queue/maildir.py
+++ b/src/mailman/queue/maildir.py
@@ -132,8 +132,8 @@ class MaildirRunner(Runner):
finally:
fp.close()
# Now we need to figure out which queue of which list this
- # message was destined for. See verp_bounce() in
- # BounceRunner.py for why we do things this way.
+ # message was destined for. See get_verp() in
+ # mailman.app.bounces for why we do things this way.
vals = []
for header in ('delivered-to', 'envelope-to', 'apparently-to'):
vals.extend(msg.get_all(header, []))