This seems to have been discussed before, but, I have a small twist. On a system I am working on, there are many users. These users can send mail via some email client or webmail, and, via command line programs (sendmail) or PHP, mailing list program, etc. I need to be able to limit outbound emails sent in any of the methods to say 100 per hour for a given user. The limit would be by user name, so, the SASL user name might be steve, and, if mail is sent by sendmail via command line, it would also be steve.
So, a policy server can't work since it doesn't deal with command line type locally submitted email. A milter MIGHT work since it can be smtpd or non smtpd, not sure, have not found one yet that might do the trick. Failing that, or some other simple solution, the simplest thing I can think of would be to simply watch the log file via a program and by parsing it as it gets written to, and keeping a count. If the limit is reached, can set postfix setting to disable locally submitted mail for the user, and, can set policy server to not accept mail from submission port. Should be pretty efficient. Is there is an easier or more elegant way someone might be using? Steve