summaryrefslogtreecommitdiff
path: root/src/mailman/chains/reject.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-08-04 01:13:04 +0000
committerBarry Warsaw2017-08-04 01:13:04 +0000
commit9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6 (patch)
treef021166b8c82bb02feff82a9360ba61a44b804ee /src/mailman/chains/reject.py
parente6326533b78290514ede917ed1cb95804759a45a (diff)
downloadmailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.tar.gz
mailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.tar.zst
mailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.zip
Diffstat (limited to 'src/mailman/chains/reject.py')
-rw-r--r--src/mailman/chains/reject.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/mailman/chains/reject.py b/src/mailman/chains/reject.py
index 31f66c8fa..6696e1900 100644
--- a/src/mailman/chains/reject.py
+++ b/src/mailman/chains/reject.py
@@ -20,11 +20,13 @@
import logging
from mailman.app.bounces import bounce_message
-from mailman.chains.base import TerminalChainBase, format_reasons
+from mailman.chains.base import TerminalChainBase
from mailman.core.i18n import _
from mailman.interfaces.chain import RejectEvent
from mailman.interfaces.pipeline import RejectMessage
+from mailman.interfaces.template import ITemplateLoader
from public import public
+from zope.component import getUtility
from zope.event import notify
@@ -56,17 +58,10 @@ class RejectChain(TerminalChainBase):
if reasons is None:
error = None
else:
- error = RejectMessage(_("""
-Your message to the {list_name} mailing-list was rejected for the following
-reasons:
-
-{reasons}
-
-The original message as received by Mailman is attached.
-""").format(
- list_name=mlist.display_name, # noqa: E122
- reasons=NEWLINE.join(format_reasons(reasons))
- ))
+ template = getUtility(ITemplateLoader).get(
+ 'list:user:notice:rejected', mlist)
+ error = RejectMessage(
+ template, reasons, dict(listname=mlist.display_name))
bounce_message(mlist, msg, error)
log.info('REJECT: %s', msg.get('message-id', 'n/a'))
notify(RejectEvent(mlist, msg, msgdata, self))