The recent discussion of bozo filters had me thinking about a more
general method of file-based message rejection. As it stands, all the
methods posted here rely on some form of grep to match the address
against a file.
This works fine, if the entire address is in the file, but I'm trying to
figure out how to do *substring* based matching. That is, if I have a
reject file that contains:
bob
bozo.net
And incoming mail from:
bob(_at_)somehost(_dot_)someplace(_dot_)com
lars(_at_)bu(_dot_)edu
Biff Smith <biff(_at_)bighost(_dot_)bozo(_dot_)net>
Then I want both the messages from bob and biff to be processed by
whatever passes for my rejection recipe (let's just say it sinks things
to /dev/null).
My question is not "how do I do this?"; it's "how do I do this
efficiently?" I could always write a shell script that would look
through each line in the reject file, and do a "echo $FROM | grep $line"
for each line in the file:
#!/bin/sh
BOZOFILE=$HOME/.bozo
FROM=`formail -zx "From:"`
# loop until we (a) find a match, or (b) finish proccessing the bozofile
while read line; do
echo $FROM | grep $line > /dev/null 2>&1 && exit 0
done < $BOZOFILE
exit 1
# end of script
However, this strikes me as being inefficient, and I like my procmail
recipes to be as self contained as possible (i.e., I prefer not to depend
on shell scripts for processing).
Any thoughts?
-- Lars
---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University