procmail
[Top] [All Lists]

Re: Sent messages

1999-12-12 18:35:35
On Dec 12,  4:29pm, S.Toms wrote:
[...]
Each message has the leading From line looking like the following
    From skull(_at_)primenet(_dot_)com Sat Aug 15 10:58:03 1998

but after it goes thru the filter I have it run thru, 
    :0
    * ^Date:.*1998
    1998

all messages after the first end up looking like the following on the From
line
    >From skull(_at_)primenet(_dot_)com Sat Aug 15 10:58:03 1998

Scott, how are you invoking procmail?  If you're running it like this:
    procmail script.rc <  sent.mbox
that would explain why all messages after the first are treated as
part of the first.  You need to "split" that mbox into separate
messages, and that is done with "formail -s":

    formail -s procmail script.rc < sent.mbox

should work better for you.

A word of warning is that not all Date: fields are well-formed.  The
thread below:
http://www.xray.mpe.mpg.de/mailing-lists/procmail/1997-02/msg00178.html
provides source for a small utility called "mdate" that will parse many of
the popular date/time strings into a canonical form.  Since there
are no strict rules on encoding dates and time (esp. time zones),
this tool works only on a best efforts basis, and will occasionally
run into something it doesn't understand.  Still, I've found it useful,
for separating mail into individual files, and timestamping their
last mod. date/times with the date/time the message was sent,
for example.

If you use that version of mdate, you'll want to fix it so that it
handles years above 1999 :).  Change this line in dateconv:

  if (yy < epoch || yy > 1999 || mm < 1 || mm > 12 ||
      dd < 1 || dd > mdays[--mm])
    return (-1);

to read:

  if (yy < epoch || yy > 2038 || mm < 1 || mm > 12 ||
      dd < 1 || dd > mdays[--mm])
    return (-1);

(the reference to 2038, is I believe the max. year that 32-bit Unix's
can represent internally).

<Prev in Thread] Current Thread [Next in Thread>