summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/mta/decorating.py6
-rw-r--r--src/mailman/mta/docs/decorating.txt48
2 files changed, 52 insertions, 2 deletions
diff --git a/src/mailman/mta/decorating.py b/src/mailman/mta/decorating.py
index 487fa8a1c..bf7472327 100644
--- a/src/mailman/mta/decorating.py
+++ b/src/mailman/mta/decorating.py
@@ -36,8 +36,10 @@ class DecoratingMixin:
def decorate(self, mlist, msg, msgdata):
"""Add recipient-specific headers and footers."""
- decorator = config.handlers['decorate']
- decorator.process(mlist, msg, msgdata)
+ # Do not decorate a message more than once.
+ if not msgdata.get('decorated', False):
+ decorator = config.handlers['decorate']
+ decorator.process(mlist, msg, msgdata)
diff --git a/src/mailman/mta/docs/decorating.txt b/src/mailman/mta/docs/decorating.txt
index 1047a9fb6..f588eed5e 100644
--- a/src/mailman/mta/docs/decorating.txt
+++ b/src/mailman/mta/docs/decorating.txt
@@ -149,3 +149,51 @@ The decorations happen when the message is delivered.
Language: English (USA)
Options: http://example.com/cperson@example.com
----------
+
+
+Decorate only once
+==================
+
+Do not decorate a message twice. Decorators must insert the 'decorated' key
+into the message metadata.
+
+ >>> msgdata['decorated'] = True
+ >>> decorating.deliver(mlist, msg, msgdata)
+ {}
+ >>> messages = list(smtpd.messages)
+ >>> len(messages)
+ 3
+
+ >>> for message in sorted(messages, key=itemgetter('x-rcptto')):
+ ... print message.as_string()
+ ... print '----------'
+ From: aperson@example.org
+ To: test@example.com
+ Subject: test one
+ Message-ID: <aardvark>
+ X-Peer: ...
+ X-MailFrom: test-bounces+aperson=example.com@example.com
+ X-RcptTo: aperson@example.com
+ <BLANKLINE>
+ This is a test.
+ ----------
+ From: aperson@example.org
+ To: test@example.com
+ Subject: test one
+ Message-ID: <aardvark>
+ X-Peer: ...
+ X-MailFrom: test-bounces+bperson=example.com@example.com
+ X-RcptTo: bperson@example.com
+ <BLANKLINE>
+ This is a test.
+ ----------
+ From: aperson@example.org
+ To: test@example.com
+ Subject: test one
+ Message-ID: <aardvark>
+ X-Peer: ...
+ X-MailFrom: test-bounces+cperson=example.com@example.com
+ X-RcptTo: cperson@example.com
+ <BLANKLINE>
+ This is a test.
+ ----------