Steven Clements wrote,
| I.e. any mails sent during 8am to midnight will be forwarded to the
| account [immediately], and any received between midnight and 8am will be
| forwarded to the account at 8am.
That shouldn't be necessary. If the destination machine is not up to collect
mail between midnight and 8 AM, then other machines trying to reach it should
requeue and retry. Procmail may not be the best tool; you may have a problem
at a deeper level.
So I guess we really need to ask why mail cannot be forwarded during the
night; there may be a better way to handle this.
Failing that, do you have crontab access on the forwarding machine? Then
in your .procmailrc
:0: # to keep a copy locally if you want
$DEFAULT
:0fwh
* ^^\/From +.+
| formail -A "Old-Postmark: $MATCH"
:0: # between midnight and 8 AM, stash it
* MATCH ?? [^ ] .* 0[0-7]:
holding-tank # with a hyphen because Steve is British
:0E # otherwise, forward now
! desti(_at_)na(_dot_)tion
Then, in your crontab,
# forward the night's accumulated mail at 8:05 AM
5 8 * * * /path/to/formail -s /path/to/sendmail desti(_at_)na(_dot_)tion <
/path/to/holding-tank && rm -f /path/to/holding-tank
I wouldn't schedule the cron job at 8:00 because if two messages arrive at
7:59 AM they might still be fighting it out over the local lock on
$MAILDIR/holding-tank, and the second one might be incompletely written to
the holding-tank folder; or it might be unwritten, still waiting for the
lock, in which case it will sit and wait until the *following* morning.
Besides, the destination machine's clock might be a little behind that of
the forwarding machine.