procmail
[Top] [All Lists]

Re: Who is the procmail maintainer? (revisited 2005)

2005-11-14 03:54:37
On 10 Nov 2005, at 13:13 , Ruud H.G. van Tol wrote:
Timothy Luoma:
Ruud H.G. van Tol:
TjL:

How do I sort mail to $MAILDIR/YYYYMMDD ? I run date(1).

You can use the date from the From_ line (or one from some other
header
field like one of the Received header fields, or even fall back to
the date in the Date header field).

Not if I want the time and date when procmail is running, not when
the message was sent.

I think you don't know what you are talking about. My procmail is
running in about the same second in which the From_ line was  
generated.

Oh come now, as someone who spent WEEKS on this list trying to get  
date parsing workign correctly and ended up with about 60 lines of  
procmail to parse From_, I call bull.  Comapring against From_ is  
currently tedious, annoying, and takes numerous passed through the  
From_ line to get the data.

$ wc -l .datefix_procmail
      100 .datefix_procmail


Now, granted, Date fix does a little more than simply parse From_ and  
a Received header, but that is MOSTLY what it does.

Here's just the beginning of the file:

WEEKDAYS = '(S(un|at)|Mon|T(ue|hu)|Wed|Fri)'
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" }


Parsing From_ and handling dates is not for the faint of heart in  
procmail.  What I could do in four or five lines of perl takes 100  
lines of procmail.

-- 
Growing up leads to growing old, and then to dying/And dying to me  
don't sound like all that much fun.



____________________________________________________________
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>