When I first saw this question I was interested to see what responses came
up. Michelle's initial reply confirmed my own thoughts: that I was going
to have to write a little external code to handle it. I promptly
wandered off to do exactly that.
This is the solution I came up with, if it is of use to anybody...
First my procmail 'blacklist.rc' file:
=====
BLACKLIST=/path/to/blacklist
:0
* ^Subject:[ ]+\/.+
* ? /usr/local/bin/testsubject $BLACKLIST "$MATCH"
.Junk.Subject/
=====
Where the "Subject:[ ]+" is actually "Subject:[<SPACE><TAB>]+" (I'm not
sure how necessary that construct is, but I picked it up from somewhere
on the 'net...)
Second, my /usr/local/bin/testsubject which is a perl script:
=====
#!/usr/bin/perl -w
use strict;
my ($file,$subj) = @ARGV;
exit 1 unless $subj;
open FILE,$file or exit 1;
foreach my $line (<FILE>) {
chomp $line;
next unless $line;
exit 0 if $subj =~ /\b$line\b/i; # <- note
}
exit 1;
=====
Essentially this reads the '/path/to/blacklist' file, and compares each
line in it with the email subject line. Note that each line will be
treated as a regular expression, and may therefore contain any PERL
REGEXP formatting required. The line which performs the comparison
(indicated by "<- note") places a "\b" either side of the line from the
blacklist file so that it will only match on whole words; it seemed a
little too dangerous to match on partials... It performs a
case-insensitive match.
Third, my preliminary /path/to/blacklist file contains the following:
=====
v[i1]agra
c[i1]alis
=====
It is precisely because of some of the standard "mis-spellings" that I
decided to enable full regular expression syntax in my blacklist file.
Of course, this only gets called by procmail (via an INCLUDERC in my
main .procmailrc file) after all other filtering for known addresses, and
examination by spamassassin, has been performed. Also, I don't know how
well it would scale if "blacklist" grew too large...
YMMV,
Pete.
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail