diff options
| author | Barry Warsaw | 2011-05-01 12:52:43 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-05-01 12:52:43 -0400 |
| commit | eb7fca85f0b2a1a18daca761a5f5f6d9ffb76a43 (patch) | |
| tree | 1797b1172b19e2f2bb05bfd5dc6a72e3cb518627 /src/mailman/queue/bounce.py | |
| parent | 53f78ee39b480c716e1738d43ffde6b01cf66028 (diff) | |
| download | mailman-eb7fca85f0b2a1a18daca761a5f5f6d9ffb76a43.tar.gz mailman-eb7fca85f0b2a1a18daca761a5f5f6d9ffb76a43.tar.zst mailman-eb7fca85f0b2a1a18daca761a5f5f6d9ffb76a43.zip | |
Diffstat (limited to 'src/mailman/queue/bounce.py')
| -rw-r--r-- | src/mailman/queue/bounce.py | 34 |
1 files changed, 2 insertions, 32 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. |
