I've got a private postfix relay VPS which is used by customers where they've installed their own e-mail servers in their offices and hosted over their ADSL connection. In the interests of reliable e-mail delivery, it's really not recommended to send mail directly from ISP IP addresses so I offer them the ability to use our private relay. However one of these customers has decided to send a newsletter to 5,000 recipients. I caught this straight away and dumped them all into the hold queue.
But now I'd like to try and flush this queue in batches, starting with the oldest messages.
Anyone got any ideas how to do this?
It looks like it would be a monster of a shell script to grep through the output of postqueue -p
If you have an idea of how old the oldest message is, you could do it with some grep and awk magic. I.e., if the oldest message is from Fri Jul 13, you could do this:
to take the first 5000 messages found for that date. This doesn't do any sorting on which time during that date the mail was sent, if you want that, you could just add the hour for each hour.