procmail
[Top] [All Lists]

Re: Doing stuff according to the time?

1999-05-25 10:27:50
(It seems that Era sent a private answer to Steve, who therefore should not
 have quoted it back into the list unless he got Era's permission.  Since I
 don't know whether Steve secured Era's permission or not, I won't quote
 Era's exact words here.)

Steve Clements followed up,

| I can use the date +%H command to find out the hour that the mail is
| received, and act on this information.

Not so good, because it is an extra process.  The timestamp of arrival is
already in your From_ line for procmail to read, or if you don't have From_
lines, in the topmost Received: header.

| This would be better, because if I receive an email from a different
| country, (eg. Your Country), then the time is different to what it is
| here.

You misunderstood Era's suggestion, Steve.  What you pointed out would be an
advantage of running the date(1) program over using the Date: header
(besides, a lot of people's Date: headers aren't right for their own time
zones either), but Era wasn't saying to the Date: header.  The From_ line or
the topmost Received: line are added by the receiving machine in its own time
zone, and Era was recommending that you use the From_ line.

Steve, I have a number of recipes that are based on matching dates, days of
the weeks, and times of day in the From_ line so that they in effect turn on
and off automatically, and they work flawlessly (if you get the regexp right).
There is no need to run a date process when the information is already there.

<Prev in Thread] Current Thread [Next in Thread>