diff options
author | Mark Sapiro <msapiro@value.net> | 2007-11-11 21:40:15 -0800 |
---|---|---|
committer | Mark Sapiro <msapiro@value.net> | 2007-11-11 21:40:15 -0800 |
commit | f383c36db54e30c67f9bf22fc1498e9fed7b65d1 (patch) | |
tree | c85b738d79c54f4660db2d90ceb4bdbc1ebfe74d /Mailman | |
parent | 70689d7eb61f8c852a6a02be1d65c86cde06bde2 (diff) | |
download | mailman2-f383c36db54e30c67f9bf22fc1498e9fed7b65d1.tar.gz mailman2-f383c36db54e30c67f9bf22fc1498e9fed7b65d1.tar.xz mailman2-f383c36db54e30c67f9bf22fc1498e9fed7b65d1.zip |
Backported Bounce recognizer changes and tests from the 3.0 branch
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Bouncers/DSN.py | 7 | ||||
-rw-r--r-- | Mailman/Bouncers/Qmail.py | 12 | ||||
-rw-r--r-- | Mailman/Bouncers/SMTP32.py | 11 | ||||
-rw-r--r-- | Mailman/Bouncers/SimpleMatch.py | 45 | ||||
-rw-r--r-- | Mailman/Bouncers/SimpleWarning.py | 20 |
5 files changed, 77 insertions, 18 deletions
diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index 869e0461..e4d2f486 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2007 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 @@ -93,6 +93,11 @@ def process(msg): # in a multipart/mixed outer part. if msg.is_multipart() and msg.get_content_subtype() == 'mixed': msg = msg.get_payload()[0] + # The above will suffice if the original message 'parts' were wrapped with + # the disclaimer added, but the original DSN can be wrapped as a + # message/rfc822 part. We need to test that too. + if msg.is_multipart() and msg.get_content_type() == 'message/rfc822': + msg = msg.get_payload()[0] # The report-type parameter should be "delivery-status", but it seems that # some DSN generating MTAs don't include this on the Content-Type: header, # so let's relax the test a bit. diff --git a/Mailman/Bouncers/Qmail.py b/Mailman/Bouncers/Qmail.py index def4abfa..2c02c1ae 100644 --- a/Mailman/Bouncers/Qmail.py +++ b/Mailman/Bouncers/Qmail.py @@ -1,17 +1,17 @@ -# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2007 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 # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. @@ -33,7 +33,9 @@ import email.Iterators introtags = [ 'Hi. This is the', "We're sorry. There's a problem", - 'Check your send e-mail address.' + 'Check your send e-mail address.', + 'This is the mail delivery agent at', + 'Unfortunately, your mail was not delivered' ] acre = re.compile(r'<(?P<addr>[^>]*)>:') diff --git a/Mailman/Bouncers/SMTP32.py b/Mailman/Bouncers/SMTP32.py index 3ad7ce44..f2397b24 100644 --- a/Mailman/Bouncers/SMTP32.py +++ b/Mailman/Bouncers/SMTP32.py @@ -1,17 +1,17 @@ -# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2007 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 # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. @@ -38,9 +38,10 @@ acre = re.compile(r''' |delivery\ failed[^:]*: # wild... |unknown\ user[^:]*: |undeliverable\ +to + |delivery\ userid[^:]*: ) \s* # space separator - (?P<addr>.*) # and finally, the address + (?P<addr>[^\s]*) # and finally, the address ''', re.IGNORECASE | re.VERBOSE) diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index 12eeffdc..2e9c23b1 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2007 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 @@ -87,6 +87,10 @@ PATTERNS = [ (_c('Unable to deliver message to the following address\(es\)\.'), _c('--- Original message follows\.'), _c('<(?P<addr>[^>]*)>:')), + # googlemail.com + (_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'), _c('^---'), @@ -97,13 +101,16 @@ PATTERNS = [ _c('^(?P<addr>[^\s@]+@[^\s@:]+):')), # thehartford.com (_c('Delivery to the following recipients failed'), - _c("Bogus - there actually isn't anything"), + # this one may or may not have the original message, but there's nothing + # unique to stop on, so stop on the first line of at least 3 characters + # that doesn't start with 'D' (to not stop immediately) and has no '@'. + _c('^[^D][^@]{2,}$'), _c('^\s*(?P<addr>[^\s@]+@[^\s@]+)\s*$')), # and another thehartfod.com/hartfordlife.com (_c('^Your message\s*$'), _c('^because:'), _c('^\s*(?P<addr>[^\s@]+@[^\s@]+)\s*$')), - # kviv.be (NTMail) + # kviv.be (InterScan NT) (_c('^Unable to deliver message to'), _c(r'\*+\s+End of message\s+\*+'), _c('<(?P<addr>[^>]*)>')), @@ -127,6 +134,38 @@ PATTERNS = [ (_c('A message that you sent could not be delivered'), _c('^---'), _c('(?P<addr>[^\s@]+@[^\s@)]+)')), + # LSMTP for Windows + (_c('^--> Error description:\s*$'), + _c('^Error-End:'), + _c('^Error-for:\s+(?P<addr>[^\s@]+@[^\s@]+)')), + # Qmail with a tri-language intro beginning in spanish + (_c('Your message could not be delivered'), + _c('^-'), + _c('<(?P<addr>[^>]*)>:')), + # socgen.com + (_c('Your message could not be delivered to'), + _c('^\s*$'), + _c('(?P<addr>[^\s@]+@[^\s@]+)')), + # dadoservice.it + (_c('Your message has encountered delivery problems'), + _c('Your message reads'), + _c('addressed to\s*(?P<addr>[^\s@]+@[^\s@)]+)')), + # gomaps.com + (_c('Did not reach the following recipient'), + _c('^\s*$'), + _c('\s(?P<addr>[^\s@]+@[^\s@]+)')), + # EYOU MTA SYSTEM + (_c('This is the deliver program at'), + _c('^-'), + _c('^(?P<addr>[^\s@]+@[^\s@<>]+)')), + # A non-standard qmail at ieo.it + (_c('this is the email server at'), + _c('^-'), + _c('\s(?P<addr>[^\s@]+@[^\s@]+)[\s,]')), + # pla.net.py (MDaemon.PRO ?) + (_c('- no such user here'), + _c('There is no user'), + _c('^(?P<addr>[^\s@]+@[^\s@]+)\s')), # Next one goes here... ] diff --git a/Mailman/Bouncers/SimpleWarning.py b/Mailman/Bouncers/SimpleWarning.py index 733994eb..45012c16 100644 --- a/Mailman/Bouncers/SimpleWarning.py +++ b/Mailman/Bouncers/SimpleWarning.py @@ -1,17 +1,17 @@ -# Copyright (C) 2001-2006 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2007 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 # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. @@ -37,6 +37,18 @@ patterns = [ (_c('The address to which the message has not yet been delivered is'), _c('No action is required on your part'), _c(r'\s*(?P<addr>\S+@\S+)\s*')), + # This is from MessageSwitch. It is a kludge because the text that + # identifies it as a warning only comes after the address. We can't + # use ecre, because it really isn't significant, so we fake it. Once + # we see the start, we know it's a warning, and we're going to return + # Stop anyway, so we match anything for the address and end. + (_c('This is just a warning, you do not need to take any action'), + _c('.+'), + _c('(?P<addr>.+)')), + # Symantec_AntiVirus_for_SMTP_Gateways - see comments for MessageSwitch + (_c('Delivery attempts will continue to be made'), + _c('.+'), + _c('(?P<addr>.+)')), # Next one goes here... ] |