summaryrefslogtreecommitdiff
path: root/src/mailman/app/docs/bounces.rst
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/app/docs/bounces.rst')
-rw-r--r--src/mailman/app/docs/bounces.rst64
1 files changed, 54 insertions, 10 deletions
diff --git a/src/mailman/app/docs/bounces.rst b/src/mailman/app/docs/bounces.rst
index 99eae8b2c..b25381031 100644
--- a/src/mailman/app/docs/bounces.rst
+++ b/src/mailman/app/docs/bounces.rst
@@ -12,12 +12,12 @@ 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('text@example.com')
+ >>> mlist = create_list('ant@example.com')
Any message can be bounced.
>>> msg = message_from_string("""\
- ... To: text@example.com
+ ... To: ant@example.com
... From: aperson@example.com
... Subject: Something important
...
@@ -36,7 +36,7 @@ to the original message author.
1
>>> print(items[0].msg.as_string())
Subject: Something important
- From: text-owner@example.com
+ From: ant-owner@example.com
To: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="..."
@@ -54,7 +54,7 @@ to the original message author.
Content-Type: message/rfc822
MIME-Version: 1.0
<BLANKLINE>
- To: text@example.com
+ To: ant@example.com
From: aperson@example.com
Subject: Something important
<BLANKLINE>
@@ -63,18 +63,16 @@ to the original message author.
--...--
An error message can be given when the message is bounced, and this will be
-included in the payload of the text/plain part. The error message must be
+included in the payload of the ``text/plain`` part. The error message must be
passed in as an instance of a ``RejectMessage`` exception.
>>> from mailman.interfaces.pipeline import RejectMessage
>>> error = RejectMessage("This wasn't very important after all.")
>>> bounce_message(mlist, msg, error)
- >>> items = get_queue_messages('virgin')
- >>> len(items)
- 1
+ >>> items = get_queue_messages('virgin', expected_count=1)
>>> print(items[0].msg.as_string())
Subject: Something important
- From: text-owner@example.com
+ From: ant-owner@example.com
To: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="..."
@@ -92,10 +90,56 @@ passed in as an instance of a ``RejectMessage`` exception.
Content-Type: message/rfc822
MIME-Version: 1.0
<BLANKLINE>
- To: text@example.com
+ To: ant@example.com
From: aperson@example.com
Subject: Something important
<BLANKLINE>
I sometimes say something important.
<BLANKLINE>
--...--
+
+The ``RejectMessage`` exception can also include a set of reasons, which will
+be interpolated into the message using the ``{reasons}`` placeholder.
+
+ >>> error = RejectMessage("""This message is rejected because:
+ ...
+ ... $reasons
+ ... """, [
+ ... 'I am not happy',
+ ... 'You are not happy',
+ ... 'We are not happy'])
+ >>> bounce_message(mlist, msg, error)
+ >>> items = get_queue_messages('virgin', expected_count=1)
+ >>> print(items[0].msg.as_string())
+ Subject: Something important
+ From: ant-owner@example.com
+ To: aperson@example.com
+ MIME-Version: 1.0
+ Content-Type: multipart/mixed; boundary="..."
+ Message-ID: ...
+ Date: ...
+ Precedence: bulk
+ <BLANKLINE>
+ --...
+ Content-Type: text/plain; charset="us-ascii"
+ MIME-Version: 1.0
+ Content-Transfer-Encoding: 7bit
+ <BLANKLINE>
+ This message is rejected because:
+ <BLANKLINE>
+ I am not happy
+ You are not happy
+ We are not happy
+ <BLANKLINE>
+ --...
+ Content-Type: message/rfc822
+ MIME-Version: 1.0
+ <BLANKLINE>
+ To: ant@example.com
+ From: aperson@example.com
+ Subject: Something important
+ <BLANKLINE>
+ I sometimes say something important.
+ <BLANKLINE>
+ --...
+ <BLANKLINE>