On 1-Jun-2007, at 16:07, Dallman Ross wrote:
Instead of LOGABSTRACT, I use:
DATE=`date '+%d-%b-%Y'`
LONGDATE=`date "+%y-%b-%d %I:%M:%S %z"`
MYLOGFILE="pm-$DATE.log" LOGABSTRACT=no
TRAP='formail -l "$LASTFOLDER" ;echo " Spam: $SPAM
Deliverd: $LONGDATE
MATCH: $MATCH
";'
when a message is delivered, the TRAP gets output to the logfile
This gives me:
From owner-postfix-users(_at_)postfix(_dot_)org Fri Jun 1 13:17:55 2007
Subject: Re: Reject unknown Sender address
Folder: /home/kremels/Mail/postfix-users/2007-06.postfix-
users 4638
Spam:
Deliverd: 07-Jun-01 01:17:55 -0600
MATCH: postfix-users(_at_)postfix(_dot_)org
Okay, but I don't see a need to run `date` twice in your
rcfile -- or even once, depending on the options you
use to call procomail in your .forward or on your system.
Sure, I COULD finagle around with getting the date some other way,
but there were a variety of reason why rewriting the FROM_ header or
getting the date from the FROM_ header was not acceptable to me at
the time I first wrote these recipes (a lot of mail I was processing
was archived email that was being resorted under a new server.
`date` is cheap and I have no issues with calling it, even twice.
And yeah, I know, I could just call it once and then set the two
dates from there. But sometimes ease of reading is an advantage.
For example, I have code similar to yours for 'fixing' dates in the
FROM_ headers that where munged by Eudora. In fact, you probably
wrote a healthy percentage of that code three or four years back..
But which is more readable, the 20 lines you have or
DATE=`date '+%d-%b-%Y'`
LONGDATE=`date "+%y-%b-%d %I:%M:%S %z"`
?
I am also using slightly different time stamps, as the DATE contains
2007 and the LONGDATE 07. Although it really should be %Y%m%d
instead... Well, easy enough to change, right? Well, it is if I am
using `date` at least...
---clip
MONTHS = '(J(an|u[ln])|Feb|Ma[ry]|A(pr|ug)|Sep|Oct|Nov|Dec)'
WHICHRECVD = 'by [^ ]*(mail.)?covisp.net'
YEARS = '(199[0-9]|20[0-9][0-9])'
TIMESTAMP = '([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]'
# dates between 1990-2099 ok. Adjust following as needed.
# NB: DATE is only trusted from the WHICHRECVD server.
# proper Received header, should work 100% of the time.
#RCVD_STAMP = "$WEEKDAYS, [0-9]+ $MONTHS $YEARS $TIMESTAMP"
# improper Received header, handles "Tue, 01" and "Tue, 1"
# ONLY use this version if your mailspool includes messages
# with improper headers on the WHICHRECVD line
RCVD_STAMP = "$WEEKDAYS, +[0-9]+ $MONTHS $YEARS $TIMESTAMP"
# Get the received header I want the date from
# (when the message hit my mailsserver)
:0
* $ ^Received:.*$WHICHRECVD.*\/$RCVD_STAMP
{ xDATE = "$MATCH" }
... 100 total lines ...
Look familiar?
---clip
--
I said pretend you've got no money, she just laughed and said, 'Eh,
you're so funny.' I said, 'Yeah? Well I can't see anyone else smiling
in here.'
____________________________________________________________
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