[Mailman-Users] Automate Moderator Functions
Mark Sapiro
mark at msapiro.net
Tue Sep 25 02:43:09 CEST 2012
Dennis Putnam wrote:
>
>The same might be true for
>exceeding the size limit.
To automatically reject or discard messages that exceed the list's size
limit, find the section of the Mailman/Handlers/Hold.py that ends with
the lines
if bodylen/1024.0 > mlist.max_message_size:
hold_for_approval(mlist, msg, msgdata,
MessageTooBig(bodylen,
mlist.max_message_size))
# no return
(there is one wrapped line in the above) and replace
hold_for_approval(mlist, msg, msgdata,
MessageTooBig(bodylen,
mlist.max_message_size))
with
rej = MessageTooBig(bodylen, mlist.max_message_size))
raise Errors.RejectMessage, rej.reason_notice
to reject the message or with
raise Errors.DiscardMessage
to discard the message. Note that this will not honor the list's
forward_auto_discards setting. to do that you would need to put
from Mailman.Handlers.Moderate import do_discard
with the other imports near the beginning of the
Mailman.Handlers.hold.py module and then replace the lines with
do_discard(mlist, msg)
If you are actually going to do any of the above, I suggest you also
put the following in mm_cfg.py for the stated reason
#
# Put MimeDel ahead of Hold so "too big" is based on content filtered
# message.
#
GLOBAL_PIPELINE.remove('MimeDel')
GLOBAL_PIPELINE.insert(GLOBAL_PIPELINE.index('Hold'), 'MimeDel')
Instead of modifying Hold.py, you could make a custom handler (see
<http://wiki.list.org/x/l4A9>) to deal with oversized messages and put
it ahead of Hold in the pipeline or possibly just replace Hold.py with
a custom version.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list