procmail
[Top] [All Lists]

Re: Time-based filtering in Procmail

2015-06-01 06:35:50
I'm no procmail expert, so others may have way better solutions, but
here's snippets of something I wrote so that my work mail will forward
to an account that I actually get on my phone, but only on weekends
and only when I'm likely to be awake.  An ugly regexp for sure, but it
gets the job done without any outside processing.  Oh, and those blank
areas are a "space + tab", not just a bunch of spaces.

---------------------------------------------------------------------
# DATE_BIN is defined in top-level .procmailrc and points to date binary

WEEKDAYHOUR = `$DATE_BIN +%u:%H`

# Don't do anything unless it's a weekend
:0
#* ^From [^     ]+[     ]+(Sat|Sun) ... .. 
([0][89]|1[0-9]|20):[0-5][0-9]:[0-5][0-9]* WEEKDAYHOUR ?? [67]:(0[89]|1[0-9]|20)
{
  :0
  Some other check
  and some action

}
--------------------------------------------------------------

Hope that helps.


On Fri, 29 May 2015, @lbutlr wrote:

Wondering if anyone has done anything with procmail and time based filtering.

For example, doing something different if a message arrive between midnight and 
6am.

It’s just some regex and the top Received line, but I’d rather not duplicate 
work.

Anyone?




--
Public key #7BBC68D9 at            |                 Shane Williams
http://pgp.mit.edu/                |      System Admin - UT CompSci
=----------------------------------+-------------------------------
All syllogisms contain three lines |              shanew(_at_)shanew(_dot_)net
Therefore this is not a syllogism  | www.ischool.utexas.edu/~shanew
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
<Prev in Thread] Current Thread [Next in Thread>