procmail
[Top] [All Lists]

Re: Optimizing recipes.

2000-08-01 05:56:09
On Mon, Jul 31, 2000 at 03:43:37PM -0400, Mike A. Harris wrote:
I'd like to optimize some of my recipes so that it minimizes
processing, and also minimizes clutter in the rc file.


<snip>

FWIW here's what I did for the same situation - 

<in procmailrc>
# Here we search the list of people we always want to get mail from,
# and deliver the mail if it's from one of them, no matter what.
# The FRIENDS file is set and described above.

:0
* ? (formail -x From: -x Sender: | fgrep -iqf $FRIENDS)
{
COMSAT=yes  # notify me of receipt if possible
:0:
$DEFAULT  # deliver to default mailbox
}

# Now we'll look for mailing lists so they don't go to SUSPECT, as
# these will not be addressed directly to us, and later we will route
# messages not addressed to us to SUSPECT.
# LISTS is set and described above.

:0hw
LIST=|formail -xSubject: -xTo: -xCc: -xSender: -xFrom: | $HOME/bin/mygrep.plx

 :0a:
 Lists/$LIST

<...snip several anti-spam rules>

<$FRIENDS points to a file with a list of email addrs of people i like>

also, I wrote a small helper script in perl for my lists - 

$ cat bin/mygrep.plx
#!/usr/bin/perl

my $lists = "/home/bringman/.procmail/lists";

open (IN, $lists) or die ("damn : $!");
my @file = <IN>;
close (<IN>);

while (<STDIN>) {
        foreach $line (@file) {
                chomp ($line) ;
                if ($_ =~ /$line/i) {
                        print (lc("$line\n"));
                        exit 0;
                }
        }
}

exit 1;

/home/bringman/.procmail/lists looks like this - 

$ cat /home/bringman/.procmail/lists
crypto-gram
SECURITYPORTAL
suse-announce
linux-quake
dns(_at_)list(_dot_)cr(_dot_)yp(_dot_)to
bugtraq
sans
openbsd
procmail
geeks-owner(_at_)monkey(_dot_)org
spamtools(_at_)abuse(_dot_)net

these are the names of the folders that I want my lists saved to, and
also a search string for Subject, to, Cc, Sender for From.

Hope this gives you some ideas.

--  
Rob Bringman

The views expressed are their own and do 
not necessarily reflect those of the author.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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