Dealing with the outbound mail quota

Has anyone programmed a solution to dealing with the mail quota?

Basically I’m picturing a script that would check a log file for how many emails were sent in the last hour, and if it exceeded the quota, then log that email into another file. Then I would need to have a script running once an hour to clear the backlog from that second file. But unless I have the specifics of the actual time of that the mail quote is working on, its very much brute force to finetune the settings. Has anyone done similar things?