summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2010-09-23 09:37:32 -0400
committerBarry Warsaw2010-09-23 09:37:32 -0400
commitb76fe2e8c8ecb95cf27ddefc44467f2e2468f951 (patch)
tree50fd97b4fb3d2b990b14c5097820a1e481548673 /src
parente5c8746854965e8a834fce9276a6a25856800b20 (diff)
downloadmailman-b76fe2e8c8ecb95cf27ddefc44467f2e2468f951.tar.gz
mailman-b76fe2e8c8ecb95cf27ddefc44467f2e2468f951.tar.zst
mailman-b76fe2e8c8ecb95cf27ddefc44467f2e2468f951.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/app/bounces.py17
-rw-r--r--src/mailman/app/docs/bounces.txt39
-rw-r--r--src/mailman/docs/NEWS.txt4
3 files changed, 51 insertions, 9 deletions
diff --git a/src/mailman/app/bounces.py b/src/mailman/app/bounces.py
index 890e040d0..c24423da2 100644
--- a/src/mailman/app/bounces.py
+++ b/src/mailman/app/bounces.py
@@ -76,11 +76,20 @@ def bounce_message(mlist, msg, e=None):
def scan_message(mlist, msg):
- """Scan all the message for heuristically determined bounce addresses."""
+ """Scan all the message for heuristically determined bounce addresses.
+
+ :param mlist: The mailing list.
+ :type mlist: `IMailingList`
+ :param msg: The bounce message to scan.
+ :type msg: `Message`
+ :return: The set of bouncing addresses found in the scanned message. The
+ set will be empty if no addresses were found.
+ :rtype: set
+ """
for detector_class in find_components('mailman.bouncers', IBounceDetector):
- addresses = detector().process(msg)
+ addresses = detector_class().process(msg)
# Detectors may return None or an empty sequence to signify that no
# addresses have been found.
if addresses:
- return addresses
- return []
+ return set(addresses)
+ return set()
diff --git a/src/mailman/app/docs/bounces.txt b/src/mailman/app/docs/bounces.txt
index 3d21ee423..f18569743 100644
--- a/src/mailman/app/docs/bounces.txt
+++ b/src/mailman/app/docs/bounces.txt
@@ -4,15 +4,13 @@ Bounces
An important feature of Mailman is automatic bounce process.
-XXX Many more converted tests go here.
-
Bounces, or message rejection
=============================
-Mailman can also bounce messages back to the original sender. This is
-essentially equivalent to rejecting the message with notification. Mailing
-lists can bounce a message with an optional error message.
+Mailman can bounce messages back to the original sender. This is essentially
+equivalent to rejecting the message with notification. Mailing lists can
+bounce a message with an optional error message.
>>> mlist = create_list('_xtest@example.com')
@@ -101,3 +99,34 @@ passed in as an instance of a ``RejectMessage`` exception.
I sometimes say something important.
<BLANKLINE>
--...--
+
+
+Scanning a message
+==================
+
+When a message hits the ``-bounces`` address for a mailing list, it is scanned
+to see if it we can dig out a set of addresses that have bounced.
+
+ >>> msg = message_from_string("""\
+ ... To: test-bounces@example.com
+ ... From: postmaster@example.org
+ ... Content-Type: multipart/report; report-type=delivery-status;
+ ... boundary="AAA"
+ ...
+ ... --AAA
+ ... Content-Type: message/delivery-status
+ ...
+ ... Action: failed
+ ... Status: 5.0.0 (recipient reached disk quota)
+ ... Original-Recipient: rfc822; aperson@example.net
+ ... Final-Recipient: rfc822; anne.person@example.net
+ ...
+ ... --AAA--
+ ... """)
+
+The DSN bouncer will return the ``Original-Recipient:`` in preference to the
+``Final-Recipient:``.
+
+ >>> from mailman.app.bounces import scan_message
+ >>> print scan_message(mlist, msg)
+ set([u'aperson@example.net'])
diff --git a/src/mailman/docs/NEWS.txt b/src/mailman/docs/NEWS.txt
index 087dc58ae..fdc81b53e 100644
--- a/src/mailman/docs/NEWS.txt
+++ b/src/mailman/docs/NEWS.txt
@@ -12,6 +12,10 @@ Here is a history of user visible changes to Mailman.
========================
(201X-XX-XX)
+Bugs fixed
+----------
+ * Typo in scan_message() (LP: #645897)
+
3.0 alpha 6 -- "Cut to the Chase"
=================================