procmail
[Top] [All Lists]

Re: How to set date/time in .procmailrc

2002-04-24 08:17:17
Reidar asked,

| Can anyone tell me how to set date in .procmailrc to only send autoreply
| at specific times??
| When someone sends email to office(_at_)domainname(_dot_)com he or she gets an
| automatic reply, but now I only want this autoreply to be sent after
| 16.00 and before 09.00, Is there a way to do this without having to use
| telnet/ftp and removing the file ????

There are several.

First, if you have cron privileges on the machine, you could set up crontab
jobs to touch a zero-size file at 4 PM and to remove it at 9 AM on workdays;
then your procmail recipe could include a condition like this:

 * ? test -f thatfile

so that the recipe would execute only when the file exists.

Second, you could run the date program for every incoming message (a little
inefficient):

 HOUR=`date +%H`

and then among the conditions for sending the autoreply,

 * HOUR ?? 09|1[0-5]

Third, and best in my opinion, is to use the timestamp already in the From_
line (or in the topmost Received: header if you don't have From_ lines):

 * ^^From .* (09|1[0-5]):..:

I use that method frequently to write recipes that will turn on or off at
specific times or dates, and it works very well for me.



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