We have a commercial, closed-source, and important server appliance, whose rudimentary email notification mechanism leaves a lot to be desired. Postfix does great as an internal relay, to forward the server’s email notifications to our staff (gmail).
Once in a while, based on events that happen, the server may generate hundreds of identical notifications - I’ve seen 800 identical emails in the span of 15 minutes. Of course it’s a major nuisance and I doubt Gmail is happy about it either; I’d like to use Postfix to intelligently filter those situations.
This isn’t your normal “protect against spammers” situation. The common rate limiters, smtpd_error_sleep_time and smtpd_soft_error_limit deal with erroneous clients.
How do you set up a filter that triggers a body_check based on the frequency of incoming messages?
I can see a few ways to go about it:
- Drop (discard?) the message if an identical body message was sent in the last X seconds.
- Compare all messages and consolidate based on identical body
- Combine the identical messages into a digest (each email is only 4 lines long, I’d rather get 8 emails, each 400 lines long, instead of 800 4-line emails.)
However I'm a Postfix noob and considering this function & priorities, I'd go for the simple, straightforward solution. For example, deploying a "real content filter program" for heavy-duty after-queue inspection seems like overkill. Hopefully the built-in content inspection process will suffice.