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.

  • +1 for addressing the real problem
    – sleske
    Sep 8 '10 at 8:48

Mailing list software like maiilman is capable of sending out message digests, but I guess those are intended for daily sending, not once a minute.

What about running your own server for this purpose that accepts as many mails as necessary?


Could you not write your application to send errors to a log file and then send that file to you via email periodically if it is not empty?

It may be preferable to handle these errors at this level as you will have more control over the processing.


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.