------------------------------------------------------------
revno: 1056
committer: Mark Sapiro <[email protected]>
branch nick: 2.2
timestamp: Fri 2009-07-31 13:14:43 -0700
message:
  Added recognition for more bounces.
added:
  Mailman/Bouncers/AOL.py
  tests/bounces/aol_01.txt
  tests/bounces/simple_37.txt
modified:
  Mailman/Bouncers/BouncerAPI.py
  Mailman/Bouncers/SimpleMatch.py
  NEWS
  tests/test_bounces.py


--
lp:mailman/2.2
https://code.launchpad.net/~mailman-coders/mailman/2.2

Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription.
=== added file 'Mailman/Bouncers/AOL.py'
--- Mailman/Bouncers/AOL.py	1970-01-01 00:00:00 +0000
+++ Mailman/Bouncers/AOL.py	2009-07-31 20:14:43 +0000
@@ -0,0 +1,45 @@
+# Copyright (C) 2009 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
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+"""Recognizes a class of messages from AOL that report only Screen Name."""
+
+import re
+from email.Utils import parseaddr
+
+scre = re.compile('mail to the following recipients could not be delivered')
+
+def process(msg):
+    if msg.get_content_type() <> 'text/plain':
+        return
+    if not parseaddr(msg.get('from', ''))[1].lower().endswith('@aol.com'):
+        return
+    addrs = []
+    found = False
+    for line in msg.get_payload(decode=True).splitlines():
+        if scre.search(line):
+            found = True
+            continue
+        if found:
+            local = line.strip()
+            if local:
+                if re.search(r'\s', local):
+                    break
+                if re.search('@', local):
+                    addrs.append(local)
+                else:
+                    addrs.append('%[email protected]' % local)
+    return addrs

=== modified file 'Mailman/Bouncers/BouncerAPI.py'
--- Mailman/Bouncers/BouncerAPI.py	2006-03-01 02:34:10 +0000
+++ Mailman/Bouncers/BouncerAPI.py	2009-07-31 20:14:43 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2009 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
@@ -53,6 +53,7 @@
     'SimpleWarning',
     'Yale',
     'LLNL',
+    'AOL',
     ]
 
 

=== modified file 'Mailman/Bouncers/SimpleMatch.py'
--- Mailman/Bouncers/SimpleMatch.py	2009-02-20 22:22:04 +0000
+++ Mailman/Bouncers/SimpleMatch.py	2009-07-31 20:14:43 +0000
@@ -174,6 +174,10 @@
     (_c('Could not deliver message to'),
      _c('^\s*--'),
      _c('^Failed Recipient:\s*(?P<addr>[...@]+@[...@]+)\s*$')),
+    # uci.edu
+    (_c('--------Message not delivered'),
+     _c('--------Error Detail'),
+     _c('^\s*(?P<addr>[...@]+@[...@]+)\s*$')),
     # Next one goes here...
     ]
 
@@ -195,7 +199,7 @@
     # we process the message multiple times anyway.
     for scre, ecre, acre in patterns:
         state = 0
-        for line in email.Iterators.body_line_iterator(msg):
+        for line in email.Iterators.body_line_iterator(msg, decode=True):
             if state == 0:
                 if scre.search(line):
                     state = 1

=== modified file 'NEWS'
--- NEWS	2009-07-31 20:07:09 +0000
+++ NEWS	2009-07-31 20:14:43 +0000
@@ -85,6 +85,8 @@
 
   Bug Fixes and other patches
 
+    - Added recognition for more bounces.
+
     - Updated contrib/mmdsr to report preserved messages.
 
 2.1.12 (23-Feb-2009)

=== added file 'tests/bounces/aol_01.txt'
--- tests/bounces/aol_01.txt	1970-01-01 00:00:00 +0000
+++ tests/bounces/aol_01.txt	2009-07-31 20:14:43 +0000
@@ -0,0 +1,19 @@
+X-MimeOLE: Produced By Microsoft Exchange V6.5
+Content-class: urn:content-classes:message
+MIME-Version: 1.0
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Subject: Mail Delivery Problem
+Date: Fri, 17 Jul 2009 16:05:21 -0700
+Message-ID: <[email protected]>
+X-MS-Has-Attach: 
+X-MS-TNEF-Correlator: 
+From: "Mail Delivery Subsystem" <[email protected]>
+To: <[email protected]>
+
+
+Your mail to the following recipients could not be delivered because =
+they are not accepting mail from [email protected]:
+	screenname
+

=== added file 'tests/bounces/simple_37.txt'
--- tests/bounces/simple_37.txt	1970-01-01 00:00:00 +0000
+++ tests/bounces/simple_37.txt	2009-07-31 20:14:43 +0000
@@ -0,0 +1,36 @@
+X-MimeOLE: Produced By Microsoft Exchange V6.5
+Content-class: urn:content-classes:message
+MIME-Version: 1.0
+Content-Type: text/plain;
+	charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+Subject: Returned mail - nameserver error report
+Date: Fri, 17 Jul 2009 16:05:22 -0700
+Message-ID: <[email protected]>
+X-MS-Has-Attach: 
+X-MS-TNEF-Correlator: 
+From: <[email protected]>
+To: <[email protected]>
+
+ --------Message not delivered to the following addresses:
+
+            [email protected]=20
+
+ --------Error Detail (phquery V3.0):
+
+---- [email protected]=20
+     Does not have a final email delivery point,
+     please contact this person by alternate means.
+=20
+       name: User Name
+       alias: USER
+
+Please contact [email protected] if you have any questions.
+
+ --------Unsent Message below:
+
+Received: from mx2.service.uci.edu (mx2.service.uci.edu =
+[128.200.59.180])
+	by mta1.service.uci.edu (8.11.4-20030923/8.11.2) with ESMTP id =
+n6HN5Mi23070;
+	Fri, 17 Jul 2009 16:05:22 -0700 (PDT)

=== modified file 'tests/test_bounces.py'
--- tests/test_bounces.py	2009-02-20 22:22:04 +0000
+++ tests/test_bounces.py	2009-07-31 20:14:43 +0000
@@ -73,6 +73,7 @@
         ('SimpleMatch', 'simple_33.txt', ['[email protected]']),
         ('SimpleMatch', 'simple_34.txt', ['[email protected]']),
         ('SimpleMatch', 'simple_36.txt', ['[email protected]']),
+        ('SimpleMatch', 'simple_37.txt', ['[email protected]']),
         ('SimpleMatch', 'bounce_02.txt', ['[email protected]']),
         ('SimpleMatch', 'bounce_03.txt', ['[email protected]']),
         # SimpleWarning
@@ -163,6 +164,7 @@
                                    '[email protected]']),
         # sina.com appears to use their own weird SINAEMAIL MTA
         ('Sina', 'sina_01.txt', ['[email protected]', '[email protected]']),
+        ('AOL', 'aol_01.txt', ['[email protected]']),
         # No address can be detected in these...
         # dumbass_01.txt - We love Microsoft. :(
         # Done

_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to