procmail
[Top] [All Lists]

Re: procmail 'if' statements

2003-12-31 14:55:59
James Marhaus wrote:

Yes, it was an adaptation of a recipe for testing whether a message was
sent outside local business hours (before 8:00 am or after 4:00 pm).
I've been using this as a "spammishness" criterion, since most of the
non-greenlisted mail received outside these hours is spam. (legitimate
new business contacts usually send email during normal hours)

Doesn't your server provide a From_ line with a timestamp? If it doesn't, you can call procmail with the -f- option (yes, hyphenfhyphen) to make procmail generate one. Then the time of receipt will be in the postmark line, and you don't need to go through this stuff.

  :0
  * ^^From .+ (0[0-7]|1[6-9]|2.):
  do_something

I regularly use that method to write recipes that turn on and off at specific dates and times. Alternatively, you can use the timestamp from the topmost Received: header, like this:

 :0
 * 1^0 ^Received:.+ \/[012][0-9]:
 * MATCH ?? 0[0-7]|1[6-9]|^^2
 do_something

But you might want to consider widening the definition of business hours to include more time zones and businesses that stay open until 5 PM.

Excellent, I will take the union of this recipe with David T.'s and post
a procmail-only "business hours" recipe if anyone is curious.

Since your lower bound and your variable can never be negative, you can safely subtract them with a simple minus sign as Dallman originally wrote.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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