Score:0

Postfix: How to trigger a body_check based on the frequency of incoming messages?

br flag

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.

  1. How do you set up a filter that triggers a body_check based on the frequency of incoming messages?

  2. 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.

anx avatar
fr flag
anx
Identical as in *byte-by-byte exact copies*? Or just multiple messages, generated at different times, each with their own `Message-ID:` header?
br flag
Multiple messages, generated at different times, each with their own Message-ID: header. Just body's content matches.
Score:0
br flag

Was going to just bump this... but I'm getting a better understanding that as an MTA, postfix doesn't really deal with stuff like this. I see that one solution is to install Dovecot and Sieve/Pigeonhole. It has a deduplication extension.

As I think it through, still sounds like a complicated heap for what I'm trying to achieve, e.g. setting up IMAP and an intermediate email account (that Gmail will accept)... And Postfix does have built-in content inspection capabilities.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.