diff options
-rw-r--r-- | Mailman/Bouncers/DSN.py | 9 | ||||
-rw-r--r-- | Mailman/Bouncers/Qmail.py | 3 | ||||
-rw-r--r-- | Mailman/Bouncers/SimpleMatch.py | 12 | ||||
-rw-r--r-- | tests/bounces/dsn_14.txt | 149 | ||||
-rw-r--r-- | tests/bounces/qmail_03.txt | 245 | ||||
-rw-r--r-- | tests/bounces/simple_16.txt | 78 | ||||
-rw-r--r-- | tests/test_bounces.py | 5 |
7 files changed, 497 insertions, 4 deletions
diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index c6e17479..869e0461 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -71,6 +71,13 @@ def check(msg): # Note that params should already be unquoted. addrs.extend(params) break + else: + # MAS: This is a kludge, but SMTP-GATEWAY01.intra.home.dk + # has a final-recipient with an angle-addr and no + # address-type parameter at all. Non-compliant, but ... + for param in params: + if param.startswith('<') and param.endswith('>'): + addrs.append(param[1:-1]) # Uniquify rtnaddrs = {} for a in addrs: @@ -89,6 +96,6 @@ def process(msg): # 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. - if not msg.is_multipart() or msg.get_subtype() <> 'report': + if not msg.is_multipart() or msg.get_content_subtype() <> 'report': return None return check(msg) diff --git a/Mailman/Bouncers/Qmail.py b/Mailman/Bouncers/Qmail.py index 2a2f8cd6..def4abfa 100644 --- a/Mailman/Bouncers/Qmail.py +++ b/Mailman/Bouncers/Qmail.py @@ -32,7 +32,8 @@ import email.Iterators # Other (non-standard?) intros have been observed in the wild. introtags = [ 'Hi. This is the', - "We're sorry. There's a problem" + "We're sorry. There's a problem", + 'Check your send e-mail address.' ] acre = re.compile(r'<(?P<addr>[^>]*)>:') diff --git a/Mailman/Bouncers/SimpleMatch.py b/Mailman/Bouncers/SimpleMatch.py index 232b8b7a..12eeffdc 100644 --- a/Mailman/Bouncers/SimpleMatch.py +++ b/Mailman/Bouncers/SimpleMatch.py @@ -89,11 +89,11 @@ PATTERNS = [ _c('<(?P<addr>[^>]*)>:')), # kundenserver.de (_c('A message that you sent could not be delivered'), - _c('^--- The header of the original'), + _c('^---'), _c('<(?P<addr>[^>]*)>')), # another kundenserver.de (_c('A message that you sent could not be delivered'), - _c('^--- The header of the original'), + _c('^---'), _c('^(?P<addr>[^\s@]+@[^\s@:]+):')), # thehartford.com (_c('Delivery to the following recipients failed'), @@ -119,6 +119,14 @@ 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 --------'), + _c('<(?P<addr>[^>]*)>')), + # cynergycom.net + (_c('A message that you sent could not be delivered'), + _c('^---'), + _c('(?P<addr>[^\s@]+@[^\s@)]+)')), # Next one goes here... ] diff --git a/tests/bounces/dsn_14.txt b/tests/bounces/dsn_14.txt new file mode 100644 index 00000000..448b4e04 --- /dev/null +++ b/tests/bounces/dsn_14.txt @@ -0,0 +1,149 @@ +Return-Path: <MAILER-DAEMON@sb7.songbird.com> +Received: from SMTP-GATEWAY01.intra.home.dk (smtp-gateway01.intra.home.dk + [193.28.149.58]) + by sb7.songbird.com (8.12.11/8.12.11) with SMTP id k2RI7T7e026491 + for <gpc-talk-bounces@grizz.org>; Mon, 27 Mar 2006 10:07:30 -0800 +Date: Mon, 27 Mar 2006 20:06:53 +0200 +In-Reply-To: <mailman.2721.1143482819.1567.gpc-talk@grizz.org> +From: Mail Delivery Subsystem <mailer-daemon@SMTP-GATEWAY01.intra.home.dk> +To: <gpc-talk-bounces@grizz.org> +Subject: Returned mail: The results of your email commands. Reason: 550 5.1.1 + User unknown +Message-ID: <smtp442829A200-A7C-442829BD-51831@[10.0.0.108]> +MIME-Version: 1.0 +Content-Type: multipart/report; + boundary="--=_smtp442829A200.A7C.2824.1811939338" +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: + +This message is in MIME format. + +----=_smtp442829A200.A7C.2824.1811939338 +Content-Type: text/plain + +The original mail was received at Mon Mar 27 18:06:29 2006 GMT from sb7.songbird.com (208.184.79.137) + +YOUR MAIL WAS NOT DELIVERED TO ALL RECIPIENTS! + + ----- The following addresses had permanent fatal errors ----- +<artboardregistration@home.dk> + + ----- Transcript of the session follows ----- +550 5.1.1 User unknown + + + +The non-delivered message is attached to this message. + +----=_smtp442829A200.A7C.2824.1811939338 +Content-Type: message/delivery-status; + name="details.txt" +Content-Disposition: attachment; + filename="details.txt" +Content-Transfer-Encoding: Quoted-Printable + +Reporting-MTA: dns; SMTP-GATEWAY01.intra.home.dk +Received-From-MTA: dns; sb7.songbird.com (208.184.79.137) +Arrival-Date: Mon Mar 27 18:06:29 2006 GMT + +Final-Recipient: <artboardregistration@home.dk> +Action: failed +Remote-MTA: MRT; 10.0.0.103 +Diagnostic-Code: SMTP; 550 5.1.1 User unknown +Last-Attempt-Date: Mon Mar 27 18:06:53 2006 GMT + +----=_smtp442829A200.A7C.2824.1811939338 +Content-Type: message/rfc822 + +Received: from (sb7.songbird.com [208.184.79.137]) + with SMTP; Mon, 27 Mar 2006 18:06:27 -0000 + (envelope-from <gpc-talk-bounces@grizz.org>) +Received: from sb7.songbird.com (sb7.songbird.com [127.0.0.1]) + by sb7.songbird.com (8.12.11/8.12.11) with ESMTP id k2RI7087026411 + for <artboardregistration@home.dk>; Mon, 27 Mar 2006 10:07:00 -0800 +Subject: The results of your email commands +From: gpc-talk-bounces@grizz.org +To: artboardregistration@home.dk +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="===============1150126487==" +Message-ID: <mailman.2721.1143482819.1567.gpc-talk@grizz.org> +Date: Mon, 27 Mar 2006 10:06:59 -0800 +Precedence: bulk +X-BeenThere: gpc-talk@grizz.org +X-Mailman-Version: 2.1.5 +List-Id: Grizzly Peak Cyclists general discussion list <gpc-talk.grizz.org> +X-List-Administrivia: yes +Sender: gpc-talk-bounces@grizz.org +Errors-To: gpc-talk-bounces@grizz.org +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: gpc-talk-bounces@grizz.org + +--===============1150126487== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +The results of your email command are provided below. Attached is your +original message. + +- Results: + Ignoring non-text/plain MIME parts + artboardregistration@home.dk is not a member of the GPC-talk mailing list + +- Unprocessed: + Re: + +- Done. + + +--===============1150126487== +Content-Type: message/rfc822 +MIME-Version: 1.0 + +Return-Path: <gpc-talk-unsubscribe@grizz.org> +Received: from email2desk.com (bl5-223-133.dsl.telepac.pt [82.154.223.133]) + by sb7.songbird.com (8.12.11/8.12.11) with SMTP id k2RI6OZT026269 + for <gpc-talk-unsubscribe@grizz.org>; Mon, 27 Mar 2006 10:06:40 -0800 +Received: from 213.226.165.165 + (SquirrelMail authenticated user artboardregistration@home.dk); + by email2desk.com with HTTP; Mon, 27 Mar 2006 18:05:12 +0000 +Message-Id: <5JcF2k.squirrel@213.226.165.165> +Date: Mon, 27 Mar 2006 18:05:12 +0000 +Subject: Re: +From: "Octavio" <artboardregistration@home.dk> +To: gpc-talk-unsubscribe@grizz.org +User-Agent: SquirrelMail/1.4.3a +X-Mailer: SquirrelMail/1.4.3a +MIME-Version: 1.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Transfer-Encoding: 8bit +X-Priority: 3 (Normal) +Importance: Normal +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: gpc-talk-unsubscribe@grizz.org + +<html> +<body> +Good morning,<br><br> +We would like to offer everything for your health from our Canadian online store!<br><br> +- All meds are FDA-approved!<br> +- No prescription required!<br> +- Worldwide shippinq!<br> +- 24/7 Customer support!<br><br> +<a href="http://gnlqgn.ulcercod.biz/?35917758">Just have a Iook at our site</a><br><br> +Best reqards,<br> + Octavio<br><br><br> +_____________________________________________________<br> +Remove <a href="http://gnlqgn.ulcercod.biz/?35917758">here</a><br> +_____________________________________________________ +</body> +</html> + + +--===============1150126487==-- +----=_smtp442829A200.A7C.2824.1811939338-- + + diff --git a/tests/bounces/qmail_03.txt b/tests/bounces/qmail_03.txt new file mode 100644 index 00000000..04e35280 --- /dev/null +++ b/tests/bounces/qmail_03.txt @@ -0,0 +1,245 @@ +Return-Path: <MAILER-DAEMON@sb7.songbird.com> +Received: from ns1.hbc.co.jp (ns1.hbc.co.jp [61.198.23.22]) + by sb7.songbird.com (8.12.11/8.12.11) with SMTP id k2R85CVU014206 + for <gpc-talk-bounces@grizz.org>; Mon, 27 Mar 2006 00:05:13 -0800 +Message-Id: <200603270805.k2R85CVU014206@sb7.songbird.com> +Received: (qmail 25914 invoked from network); 27 Mar 2006 17:04:37 +0900 +Received: from unknown (HELO pop.hbc.co.jp) (192.168.0.122) + by ns1.hbc.co.jp with SMTP; 27 Mar 2006 17:04:37 +0900 +Received: (qmail 29689 invoked for bounce); 27 Mar 2006 17:04:37 +0900 +Date: 27 Mar 2006 17:04:37 +0900 +From: MAILER-DAEMON@pop.hbc.co.jp +To: gpc-talk-bounces@grizz.org +Subject: failure notice +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: + +He/Her is not HBC e-mail users. +Check your send e-mail address. + +<crown@hbc.co.jp>: +Sorry, no mailbox here by that name. vpopmail (#5.1.1) + +--- Below this line is a copy of the message. + +Return-Path: <gpc-talk-bounces@grizz.org> +Received: (qmail 29686 invoked from network); 27 Mar 2006 17:04:37 +0900 +Received: from unknown (HELO PUMPKIN) (172.16.16.22) + by pop.hbc.co.jp with SMTP; 27 Mar 2006 17:04:37 +0900 +Received: from ns1.hbc.co.jp ([192.168.0.22]) by PUMPKIN with InterScan Messaging Security Suite; Mon, 27 Mar 2006 17:24:52 +0900 +Received: (qmail 25911 invoked from network); 27 Mar 2006 17:04:36 +0900 +Received: from unknown (HELO sb7.songbird.com) (208.184.79.137) + by ns1.hbc.co.jp with SMTP; 27 Mar 2006 17:04:36 +0900 +Received: from sb7.songbird.com (sb7.songbird.com [127.0.0.1]) + by sb7.songbird.com (8.12.11/8.12.11) with ESMTP id k2R853Ol014177 + for <crown@hbc.co.jp>; Mon, 27 Mar 2006 00:05:03 -0800 +Subject: The results of your email commands +From: gpc-talk-bounces@grizz.org +To: crown@hbc.co.jp +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="===============0630961367==" +Message-ID: <mailman.2720.1143446702.1567.gpc-talk@grizz.org> +Date: Mon, 27 Mar 2006 00:05:02 -0800 +Precedence: bulk +X-BeenThere: gpc-talk@grizz.org +X-Mailman-Version: 2.1.5 +List-Id: Grizzly Peak Cyclists general discussion list <gpc-talk.grizz.org> +X-List-Administrivia: yes +Sender: gpc-talk-bounces@grizz.org +Errors-To: gpc-talk-bounces@grizz.org +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: gpc-talk-bounces@grizz.org + +--===============0630961367== +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit + +The results of your email command are provided below. Attached is your +original message. + +- Results: + Ignoring non-text/plain MIME parts + +- Unprocessed: + =20 + Do you want to b O f V e E u R w P l A f Y for your c M l e b d d i b c + i a l t w i x o o n x s? + =20 + I don't think you need it, c S y A o V d E p 5 w 0 h % with + http://soki65.kapermet.com + +- Done. + + +--===============0630961367== +Content-Type: message/rfc822 +MIME-Version: 1.0 + +Return-Path: <crown@hbc.co.jp> +Received: from hbc.co.jp (200-202-221-208.caboja.speeduol.com.br + [200.202.221.208]) + by sb7.songbird.com (8.12.11/8.12.11) with SMTP id k2R84qts014129 + for <gpc-talk-request@grizz.org>; Mon, 27 Mar 2006 00:04:55 -0800 +Message-ID: <000001c65174$f9cbb150$e45ea8c0@xxe54> +Reply-To: "Radomila Crown" <crown@hbc.co.jp> +From: "Radomila Crown" <crown@hbc.co.jp> +To: gpc-talk-request@grizz.org +Subject: Re: new +Date: Mon, 27 Mar 2006 03:03:47 -0500 +MIME-Version: 1.0 +Content-Type: multipart/alternative; + boundary="----=_NextPart_000_0001_01C6514B.10F5A950" +X-Priority: 3 +X-MSMail-Priority: Normal +X-Mailer: Microsoft Outlook Express 6.00.2800.1106 +X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: crown@hbc.co.jp + +This is a multi-part message in MIME format. + +------=_NextPart_000_0001_01C6514B.10F5A950 +Content-Type: text/plain; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +Hi, +=20 +Do you want to b O f V e E u R w P l A f Y for your c M l e b d d i b c +i a l t w i x o o n x s? +=20 +I don't think you need it, c S y A o V d E p 5 w 0 h % with +http://soki65.kapermet.com + +------=_NextPart_000_0001_01C6514B.10F5A950 +Content-Type: text/html; + charset="us-ascii" +Content-Transfer-Encoding: quoted-printable + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<HTML><HEAD> +<META http-equiv=3DContent-Type content=3D"text/html; = +charset=3Dus-ascii"> +<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR> +<STYLE></STYLE> +</HEAD> +<BODY bgColor=3D#ffffff> +<DIV>Hi,</DIV> +<DIV> </DIV> +<DIV>Do you want to <span style=3D" +float +: +right +"> b </span>O<span style=3D" +float +: +right +"> f </span>V<span style=3D" +float +: +right +"> e </span>E<span style=3D" +float +: +right +"> u </span>R<span style=3D" +float +: +right +"> w </span>P<span style=3D" +float +: +right +"> l </span>A<span style=3D" +float +: +right +"> f </span>Y for your <span style=3D" +float +: +right +"> c </span>M<span style=3D" +float +: +right +"> l </span>e<span style=3D" +float +: +right +"> b </span>d<span style=3D" +float +: +right +"> d </span>i<span style=3D" +float +: +right +"> b </span>c<span style=3D" +float +: +right +"> i </span>a<span style=3D" +float +: +right +"> l </span>t<span style=3D" +float +: +right +"> w </span>i<span style=3D" +float +: +right +"> x </span>o<span style=3D" +float +: +right +"> o </span>n<span style=3D" +float +: +right +"> x </span>s?</DIV> +<DIV> </DIV> +<DIV>I don't think you need it, <span style=3D" +float +: +right +"> c </span>S<span style=3D" +float +: +right +"> y </span>A<span style=3D" +float +: +right +"> o </span>V<span style=3D" +float +: +right +"> d </span>E <span style=3D" +float +: +right +"> p </span>5<span style=3D" +float +: +right +"> w </span>0<span style=3D" +float +: +right +"> h </span>% with <A = +href=3D"http://soki65.kapermet.com">http://soki65.kapermet.com</A></DIV><= +/BODY></HTML> +------=_NextPart_000_0001_01C6514B.10F5A950-- + + + + +--===============0630961367==-- + + diff --git a/tests/bounces/simple_16.txt b/tests/bounces/simple_16.txt new file mode 100644 index 00000000..4ab1f1be --- /dev/null +++ b/tests/bounces/simple_16.txt @@ -0,0 +1,78 @@ +Return-Path: <MAILER-DAEMON@sb7.songbird.com> +Received: from uranus.cinergycom.net (uranus.cinergycom.net [216.135.2.7]) + by sb7.songbird.com (8.12.11/8.12.11) with ESMTP id k2V74mN8029551 + for <gpc-talk-bounces@grizz.org>; Thu, 30 Mar 2006 23:04:48 -0800 +Received: from gaffer.cinergycom.net ([216.135.3.23]) + by uranus.cinergycom.net with esmtp (Exim 4.60) id 1FPDg3-0003Ii-8c + for gpc-talk-bounces@grizz.org; Fri, 31 Mar 2006 01:04:11 -0600 +Received: from root by gaffer.cinergycom.net with local (Exim 4.52) + id 1FPDg3-0007ln-3j + for gpc-talk-bounces@grizz.org; Fri, 31 Mar 2006 01:04:11 -0600 +Auto-Submitted: auto-generated +From: Mail Delivery System <Mailer-Daemon@gaffer.cinergycom.net> +To: gpc-talk-bounces@grizz.org +Subject: Mail delivery failed: returning message to sender +Message-Id: <E1FPDg3-0007ln-3j@gaffer.cinergycom.net> +Date: Fri, 31 Mar 2006 01:04:11 -0600 +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: + +This message was created automatically by mail delivery software. + +A message that you sent could not be delivered to one or more of its +recipients. This is a permanent error. The following address(es) failed: + + an undisclosed address + (generated from xvlogtfsei@the-messenger.com) + +------ This is a copy of the message, including all the headers. ------ + +Return-path: <gpc-talk-bounces@grizz.org> +Received: from sb7.songbird.com ([208.184.79.137]) + by gaffer.cinergycom.net with esmtp (Exim 4.52) + id 1FPDg0-0007jU-1y + for xvlogtfsei@the-messenger.com; Fri, 31 Mar 2006 01:04:10 -0600 +Received: from sb7.songbird.com (sb7.songbird.com [127.0.0.1]) + by sb7.songbird.com (8.12.11/8.12.11) with ESMTP id k2V74GQL029495 + for <xvlogtfsei@the-messenger.com>; Thu, 30 Mar 2006 23:04:16 -0800 +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Subject: Your message to GPC-talk awaits moderator approval +From: gpc-talk-bounces@grizz.org +To: xvlogtfsei@the-messenger.com +Message-ID: <mailman.9022.1143788655.1568.gpc-talk@grizz.org> +Date: Thu, 30 Mar 2006 23:04:15 -0800 +Precedence: bulk +X-BeenThere: gpc-talk@grizz.org +X-Mailman-Version: 2.1.5 +List-Id: Grizzly Peak Cyclists general discussion list <gpc-talk.grizz.org> +X-List-Administrivia: yes +Sender: gpc-talk-bounces@grizz.org +Errors-To: gpc-talk-bounces@grizz.org +X-SongbirdInformation: support@songbird.com for more information +X-Songbird: Clean +X-Songbird-From: gpc-talk-bounces@grizz.org +X-CCC-Cleanmail-Spam-Version: 1.1 +X-CCC-Cleanmail-Spam-Extended-Info: SA score = 0.6/5.0 + * 0.6 NO_REAL_NAME From: does not include a real name +X-CCC-Cleanmail-Spam: No spam detected + +Your mail to 'GPC-talk' with the subject + + GAIN UP + +Is being held until the list moderator can review it for approval. + +The reason it is being held: + + Post by non-member to a members-only list + +Either the message will get posted to the list, or you will receive +notification of the moderator's decision. If you would like to cancel +this posting, please visit the following URL: + + http://www.grizz.org/mailman/confirm/gpc-talk/420aa8073840d743a30950f4a67869bf3a253dd3 + + diff --git a/tests/test_bounces.py b/tests/test_bounces.py index c3e0dc9b..91d79403 100644 --- a/tests/test_bounces.py +++ b/tests/test_bounces.py @@ -56,6 +56,9 @@ class BounceTest(unittest.TestCase): ('SimpleMatch', 'simple_14.txt', ['dump@dachamp.com', 'iqxwmmfauudpo@dachamp.com']), ('SimpleMatch', 'simple_15.txt', ['isam@kviv.be']), + ('SimpleMatch', 'simple_16.txt', ['xvlogtfsei@the-messenger.com']), + ('SimpleMatch', 'bounce_02.txt', ['acinsp1@midsouth.rr.com']), + ('SimpleMatch', 'bounce_03.txt', ['james@jeborall.demon.co.uk']), # SimpleWarning ('SimpleWarning', 'simple_03.txt', Stop), # GroupWise @@ -83,6 +86,7 @@ class BounceTest(unittest.TestCase): ('DSN', 'dsn_11.txt', ['joem@example.com']), ('DSN', 'dsn_12.txt', ['auaauqdgrdz@jtc-con.co.jp']), ('DSN', 'dsn_13.txt', ['marcooherbst@cardinal.com']), + ('DSN', 'dsn_14.txt', ['artboardregistration@home.dk']), # Microsoft Exchange ('Exchange', 'microsoft_01.txt', ['DJBENNETT@IKON.COM']), ('Exchange', 'microsoft_02.txt', ['MDMOORE@BALL.COM']), @@ -97,6 +101,7 @@ class BounceTest(unittest.TestCase): # Qmail ('Qmail', 'qmail_01.txt', ['psadisc@wwwmail.n-h.de']), ('Qmail', 'qmail_02.txt', ['rauschlo@frontfin.com']), + ('Qmail', 'qmail_03.txt', ['crown@hbc.co.jp']), # LLNL's custom Sendmail ('LLNL', 'llnl_01.txt', ['trotts1@llnl.gov']), # Netscape's server... |