On Wed, Oct 05, 2005 at 11:12:46PM +0200, Dallman Ross wrote:
On Wed, Oct 05, 2005 at 09:16:14PM +0200, Francesco Peeters wrote:
Is there an easy and cheap (in resource sense) to determine
the age of an e-mail and toss it in NULL if it's older than
a specific age (for instance older than 1 year) using only
procmail?
If you find the From_ header's date trustworthy enough, sure.
Well, "easy" is in the eye of the beholder. Also, to do it *only*
in procmail, you'll need to be able to read in today's date from
a file. You could generate it once daily via cron. It would
contain, e.g.:
TODAY = 20051005
-------------------------------
The rcfile doing the comparison would have:
Here is a slightly improved version. The old one worked;
this is just icing on the efficiency cake.
#################### start rc.oneyear ####################
INCLUDERC = rc.today # read in today's date as YYYYMMDD
MON_TBL = Jan01Feb02Mar03Apr04May05Jun06Jul07Aug08Sep09Oct10Nov11Dec12
:0
* () (Mon|Tue|Wed|Thu|Fri|Sat|Sun) ()\/[JFMASOND][aepuco][nbrylgptvc] ().+
{ H_FROM_ = $MATCH }
:0
* MATCH ?? ^^\/[a-z]+
* $ MON_TBL ?? $MATCH\/[0-9]+
{ MM = $MATCH }
:0
* H_FROM_ ?? ()\/[0-9]+^^
{ YEAR = $MATCH }
:0
* H_FROM_ ?? ()\/[0-3]?[0-9] ()
* MATCH ?? ^^\/[0-9]+
* $ $MATCH ^0
* -9 ^0
{ DD = $MATCH } # no zero-padding needed for DD > 9
:0 E
* $ $MATCH ^0
{ DD = 0$MATCH } # zero-padding added for DD < 10
:0
* $ $TODAY ^0
* $ -$YEAR$MM$DD ^0
* -9999 ^0
{ HOST = toodamnold }
##################### end rc.oneyear #####################
Dallman
____________________________________________________________
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