mhonarc-users

Re: mail filter to run before using mhonarc

1996-04-15 15:36:19
Terry Todd said:
I am subscribed to some mailing lists that I would like to separate
out into their own mail files before I run mhonarc on them.
Does anyone have any pointers?  I know filter sorts out mail as
it comes in.  I would rather have a program that I can run on
a mailbox and have it sort them out.  In other words I would like
all mail from mailing list 1 to end up in 1 file and all mail from
mailing list 2 to end up in a second file and all other mail to
stay in my mailbox.

I had the same problem some time ago. My solution was to use a small
perl script to read the mbox file and pipe each message into procmail.
I used a simple (dump) rule to save a mailing list into a seperate
mbox file. I append the perl script and procmailrc file at the end as
an example.

BTW mhonarc is great!

Totally agreed.

Achim


==> x.doit <==
#
# Usage: perl x.doit mbox1 mbox2 ...
# the filtered output is written to x.box (see x.procmailrc)
# 
$i=0;
#$cmd = "cat -n";
$cmd = "procmail $ENV{PWD}/x.procmailrc";

while ($line = <ARGV>) {
        if ($line =~ /^From /) {
                close OUT if $i;
                $i++;
                #print "*" x 80, "\n";
                print sprintf("mail # %d\n",$i);
                open OUT, "| $cmd";
        }

        print OUT $line;
}

==> x.procmailrc <==

#VERBOSE=on


#save all hyper-g mail to a seperate mbox file

MY_MBOX=/home/ach/data1/mbox/x.mbox

:0: $MY_MBOX$LOCKEXT
* ^TO(hyper-g@)
* !From ach
* !Return-path: ach
{
        :0
        $MY_MBOX

}

#everything else is writen to /dev/null

:0: $MY_MBOX$LOCKEXT
* ^.
/dev/null


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