Reject email based on message size.
Dear all,
We have a few mailing lists with a message size limit of 512K. At the same time, these mailing lists are moderated by designated moderators. As configured, posts with a message size greater than 512K are held for moderation. However, even after multiple reminders, some moderators accept these postings.
Is there a way to automatically reject all such messages with an appropriate rejection reason? Can we implement a custom rule or a plugin that will help in this case?
Regards, Hitachi.
On Tue, Dec 16, 2025 at 7:32 AM Hitashi mancho via Mailman-users < mailman-users@mailman3.org> wrote:
Dear all,
We have a few mailing lists with a message size limit of 512K. At the same time, these mailing lists are moderated by designated moderators. As configured, posts with a message size greater than 512K are held for moderation. However, even after multiple reminders, some moderators accept these postings.
Is there a way to automatically reject all such messages with an appropriate rejection reason? Can we implement a custom rule or a plugin that will help in this case?
The best place to achieve that is at the MTA level.
However, for completeness, you can also check the various config options available for Mailman core: https://gitlab.com/mailman/mailman/-/blob/master/src/mailman/config/schema.c...
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
Hitashi mancho via Mailman-users writes:
As configured, posts with a message size greater than 512K are held for moderation. However, even after multiple reminders, some moderators accept these postings.
Is there a way to automatically reject all such messages with an appropriate rejection reason?
Not at present. The size limitation option does not allow specification of an action. I don't recall whether the action is hardcoded in the size limitation or whether it follows a configuration for members or nonmembers.
Can we implement a custom rule or a plugin that will help in this case?
The documentation for plugins is here: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/plugins/doc... Unfortunately I don't know of an example of a plugin that's in production somewhere (I tried to implement a list style as a plugin once but it didn't work first try and I'd already had to vendor the source for that client, so I just hacked that in too).
However, implementing what you want as a plugin probably requires a large amount of work. If making a local branch of the sources is OK for you, simply changing the ('max-size', LinkAction.defer, None) element in mailman/chains/builtin.py:BuiltInChain._link_discriptions to ('max-size', LinkAction.jump, 'reject') should be enough for you. You may also want to modify the "list:user:notice:rejected" template to explain the 'max-size' policy,
You also might need to move that element above the "# Do all of the following before deciding whether to hold the message." comment, or possibly to the very beginning of the list. Moving to the very beginning has the advantage of saving a lot of work in that case, but it has the disadvantage that if there are other rule hits that would cause the message to be held, they won't be recorded and reported to sender.
-- GNU Mailman consultant (installation, migration, customization) Sirius Open Source https://www.siriusopensource.com/ Software systems consulting in Europe, North America, and Japan
participants (3)
-
Hitashi mancho -
Odhiambo Washington -
Stephen J. Turnbull