We're developing an application that runs on multiple hosts and emails notifications to us (the developers @gmail.com) whenever something goes wrong, via a postfix server. However, we've run into issues where the application spews hundreds of such errors in rapid succession, leading Gmail to bounce our messages. This is why we're interested first and foremost throttling messages, but ideally also aggregating messages together into a periodic digest that is emitted at most once per minute. Are there any tools or Postfix extensions suitable for us? Thanks.
Error reporting via email is a quick hack - but as you're discovering its far from an ideal solution.
At best, the solution you propose will delay sending out notifications.
I'd recommend having a look at Nagios. In addition to scheduling checks to run on systems it can also be cofigured to accept notifications about system status from other sources (e.g. email) then make intelligent decisions about notifications, automated responses and escalations.
Usually I prefer mailing list software such as Mailman or Majordomo, or Policyd for implementing sender quotas etc in Postfix, but just to be different this time:
If you're willing to write some Perl, qpsmtpd can be hooked to Postfix by using the
content_filter parameter in Postfix. Just write your own qpsmtpd-plugin which keeps track of throttling and/or queues the messages and combines them as a single message before finally sending them out.
This might sound like a lot of work, but should actually be surprisingly easy. Couple of years ago I wrote a plugin which throttled mail sent via PHP and started to quarantine them after a certain threshold to prevent script-kiddies spamming. The threshold bookkeeping was done in MySQL. The whole script, including comments and a short help section, was only 132 lines of code.
qpsmtpd is bundled with many plugins already, so just learn the basics from those and write your own. This might lead to reinventing the wheel.