Jonathan Knight wrote:
>
>I supose what I'm looking for is the auto-reject facility for an
>exceeded message size and I notice the same request scattered through
>the mail archives. I wonder whether there is an accepted solution for
>doing this?
Since you use Exim, you may be able to modify the Mailman router in
Exim to reject the message at incoming SMTP time and not involve
Mailman at all. This has the added advantage that you won't be
rejecting spam to forged From: addresses.
However, if you want to do this in Mailman, the quick and dirty
approach is to patch Mailman/Handlers/Hold.py with the patch in the
attached Hold.patch.txt file. This patch ignores the list setting
completely and requires that you put MAX_MESSAGE_SIZE = n (n is the
size in KB) in mm_cfg.py to set a size limit.
As Barry suggests, the cleaner approach is a custom handler. See the
FAQ at <http://wiki.list.org/x/l4A9>.
--
Mark Sapiro <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
--- Mailman/Handlers/Hold.py 2008-06-23 10:43:21.000000000 -0700
+++ Mailman/Handlers/Hold.py 2010-02-22 10:18:56.812500000 -0800
@@ -172,7 +172,7 @@
# no return
#
# Is the message too big?
- if mlist.max_message_size > 0:
+ if hasattr(mm_cfg, 'MAX_MESSAGE_SIZE'):
bodylen = 0
for line in email.Iterators.body_line_iterator(msg):
bodylen += len(line)
@@ -181,9 +181,9 @@
bodylen += len(part.preamble)
if part.epilogue:
bodylen += len(part.epilogue)
- if bodylen/1024.0 > mlist.max_message_size:
- hold_for_approval(mlist, msg, msgdata,
- MessageTooBig(bodylen, mlist.max_message_size))
+ if bodylen/1024.0 > mm_cfg.MAX_MESSAGE_SIZE:
+ err = MessageTooBig(bodylen, mm_cfg.MAX_MESSAGE_SIZE)
+ raise Errors.RejectMessage, err.reason_notice()
# no return
#
# Are we gatewaying to a moderated newsgroup and is this list the
_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy: http://wiki.list.org/x/QIA9