diff options
author | Mark Sapiro <mark@msapiro.net> | 2008-06-15 12:39:31 -0700 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2008-06-15 12:39:31 -0700 |
commit | f0562e55bb47dd29a832bb8d6b6fed8d0555138c (patch) | |
tree | ba1f0a579043ec4221f75a2c3daf78336232a2a1 /Mailman/Bouncers | |
parent | bb2624102c8d3c63b6b3e8b56f88fb1507ead034 (diff) | |
download | mailman2-f0562e55bb47dd29a832bb8d6b6fed8d0555138c.tar.gz mailman2-f0562e55bb47dd29a832bb8d6b6fed8d0555138c.tar.xz mailman2-f0562e55bb47dd29a832bb8d6b6fed8d0555138c.zip |
Made several improvements to bounce recognition.
Diffstat (limited to 'Mailman/Bouncers')
-rw-r--r-- | Mailman/Bouncers/DSN.py | 9 | ||||
-rw-r--r-- | Mailman/Bouncers/GroupWise.py | 4 | ||||
-rw-r--r-- | Mailman/Bouncers/SimpleMatch.py | 16 |
3 files changed, 19 insertions, 10 deletions
diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index e4d2f486..2eacd0f4 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2007 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -89,6 +89,13 @@ def check(msg): def process(msg): + # We've seen some fairly bogus DSNs, allegedly from postfix that are + # multipart/mixed with 3 subparts - a text/plain postfix like part, a + # message/delivery-status part and a message/rfc822 part with the original + # message. Deal with it as follows. + if (msg.is_multipart() and len(msg.get_payload()) == 3 and + msg.get_payload()[1].get_content_type() == 'message/delivery-status'): + return check(msg.get_payload()[1]) # A DSN has been seen wrapped with a "legal disclaimer" by an outgoing MTA # in a multipart/mixed outer part. if msg.is_multipart() and msg.get_content_subtype() == 'mixed': diff --git a/Mailman/Bouncers/GroupWise.py b/Mailman/Bouncers/GroupWise.py index 7ef31256..74116135 100644 --- a/Mailman/Bouncers/GroupWise.py +++ b/Mailman/Bouncers/GroupWise.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -46,6 +46,8 @@ def find_textplain(msg): def process(msg): if msg.get_type() <> 'multipart/mixed' or not msg['x-mailer']: return None + if msg['x-mailer'][:3].lower() not in ('nov', 'ntm', 'int'): + return None addrs = {} # find the first text/plain part in the message textplain = find_textplain(msg) diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index 2e9c23b1..068dc45c 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2007 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2008 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -91,12 +91,12 @@ PATTERNS = [ (_c('Delivery to the following recipient failed'), _c('----- Original message -----'), _c('^\s*(?P<addr>[^\s@]+@[^\s@]+)\s*$')), - # kundenserver.de - (_c('A message that you sent could not be delivered'), + # kundenserver.de, mxlogic.net + (_c('A message that you( have)? sent could not be delivered'), _c('^---'), _c('<(?P<addr>[^>]*)>')), # another kundenserver.de - (_c('A message that you sent could not be delivered'), + (_c('A message that you( have)? sent could not be delivered'), _c('^---'), _c('^(?P<addr>[^\s@]+@[^\s@:]+):')), # thehartford.com @@ -126,9 +126,9 @@ PATTERNS = [ (_c('^Invalid final delivery userid:'), _c('^Original message follows.'), _c('\s*(?P<addr>[^\s@]+@[^\s@]+)\s*$')), - # E500_SMTP_Mail_Service@lerctr.org - (_c('------ Failed Recipients ------'), - _c('-------- Returned Mail --------'), + # E500_SMTP_Mail_Service@lerctr.org and similar + (_c('---- Failed Recipients ----'), + _c(' Mail ----'), _c('<(?P<addr>[^>]*)>')), # cynergycom.net (_c('A message that you sent could not be delivered'), @@ -196,7 +196,7 @@ def process(msg, patterns=None): if mo: addr = mo.group('addr') if addr: - addrs[mo.group('addr')] = 1 + addrs[addr.strip('<>')] = 1 elif ecre.search(line): break if addrs: |