procmail
[Top] [All Lists]

Re: Sent messages

1999-12-13 06:54:21
On Sun, 12 Dec 1999, S.Toms wrote:

  I'm wondering if someone would know a way to do this, my sent folder is
in excess of 5mb at this time, and I was wanting to seperate it out into
individual folders based on month and year, the way that pine does at the

I have some older text I wrote for myself when I had similar problem.
Here it is. THe reason why I avoided those tricks with FILENO variable or
advices with `date [vars]` shell command was that the first didn't work
for me and second used CURRENT system date and did not bother of Date:
field in messages.




Converting mail archives:

I needed to convert some mail archives into separate mailforders
according to date. First of all, I had to edit them so all
messages started with so called From_ line. I thought that there
should be even some empty lines before this From_ line, so I used
sed to do it.

This is the From_ line:
From krb4-owner(_at_)sics(_dot_)se Fri Oct  1 02:40:17 1999


shell$ cat krb4 | sed 's/\(>From\)/\
\
From/' > krb-new
shell$ 


Then I was able to use formail and procmail to read every date" field from
every message and save it to a folder like krb4.YYMM:

shell$ formail -b -s procmail -m date.rc < mail.archive


The date.rc file contained:
# date.rc - is using Jari Alto procmail modules from 
#  http://www.procmail.org/jari/pm-code.zip
#
PMSRC=/etc/procmail
LOGFILE=/usr/majordomo/procmail.log
INCLUDERC=/etc/procmail/pm-jadate.rc

LIST    = krb4
EXT     = "$YY$MM"      # 9910

# deliver messages into krb4.9910 etc.
:0:
$LIST.$EXT


The problem then was, that MHonarc 2.4.3 nor 2.4.4 did not see the archive
as an archive of mails, but rather as one long email (Starting with
From foo(_at_)bar ). This was because formail "fixed" all those unescaped From_
lines (so all looked then as >From and the first line had real From_ line 
as From foo(_at_)bar). 
So, I decided to use formail to extract every message again (so formail 
didn't have to fix all those From_ lines) and pipe it into MHonArc, which
should convert it into HTML form.


This command did not work:

shell$ cat ../../krb4.archive/krb4.9910 | formail -b -s \
 /usr/majordomo/perl/bin/mhonarc -rcfile \
 /usr/local/www/apache/share/cgi/.wilma/krb4.rc -add 


But this really worked.

shell$ formail -b -s /usr/majordomo/perl/bin/mhonarc -rcfile \
 /usr/local/www/apache/share/cgi/.wilma/krb4.rc -add < \
 ../../krb4.archive/krb4.9910

So now everything works, but requires little bit too much memory/cpu to my 
taste. ;-)

--
Martin Mokrejs - PGP 5.0i key at: finger://mail.natur.cuni.cz/mmokrejs
<mmokrejs(_at_)natur(_dot_)cuni(_dot_)cz> Faculty of Science, The Charles 
University

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