diff options
Diffstat (limited to 'Mailman/Bouncers')
-rw-r--r-- | Mailman/Bouncers/BouncerAPI.py | 12 | ||||
-rw-r--r-- | Mailman/Bouncers/DSN.py | 10 | ||||
-rw-r--r-- | Mailman/Bouncers/Qmail.py | 18 |
3 files changed, 24 insertions, 16 deletions
diff --git a/Mailman/Bouncers/BouncerAPI.py b/Mailman/Bouncers/BouncerAPI.py index e99d00ae..e19c53f7 100644 --- a/Mailman/Bouncers/BouncerAPI.py +++ b/Mailman/Bouncers/BouncerAPI.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Contains all the common functionality for msg bounce scanning API. @@ -62,10 +63,7 @@ def ScanMessages(mlist, msg): modname = 'Mailman.Bouncers.' + module __import__(modname) addrs = sys.modules[modname].process(msg) - if addrs is Stop: - # One of the detectors recognized the bounce, but there were no - # addresses to extract. Return the empty list. - return [] - elif addrs: + if addrs: + # Return addrs even if it is Stop. BounceRunner needs this info. return addrs return [] diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index d87899c4..d78a1f4f 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2003 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Parse RFC 3464 (i.e. DSN) bounce formats. @@ -52,9 +53,10 @@ def check(msg): # # Also grok out Action so we can do something with that too. action = msgblock.get('action', '').lower() - if action == 'delayed': + # Some MTAs have been observed that put comments on the action. + if action.startswith('delayed'): return Stop - if action not in ('failed', 'failure'): + if not action.startswith('fail'): # Some non-permanent failure, so ignore this block continue params = [] diff --git a/Mailman/Bouncers/Qmail.py b/Mailman/Bouncers/Qmail.py index f6019ce8..2a2f8cd6 100644 --- a/Mailman/Bouncers/Qmail.py +++ b/Mailman/Bouncers/Qmail.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Parse bounce messages generated by qmail. @@ -28,7 +29,11 @@ This module should be conformant. import re import email.Iterators -introtag = 'Hi. This is the' +# Other (non-standard?) intros have been observed in the wild. +introtags = [ + 'Hi. This is the', + "We're sorry. There's a problem" + ] acre = re.compile(r'<(?P<addr>[^>]*)>:') @@ -42,8 +47,11 @@ def process(msg): state = 0 for line in email.Iterators.body_line_iterator(msg): line = line.strip() - if state == 0 and line.startswith(introtag): - state = 1 + if state == 0: + for introtag in introtags: + if line.startswith(introtag): + state = 1 + break elif state == 1 and not line: # Looking for the end of the intro paragraph state = 2 |