-----Original Message-----
From: David F. Skoll [mailto:dfs@roaringpenguin.com] 

> Not $Subject, specifically, but our CanIt product is almost completely
> database-driven.  We use a PostgreSQL database, but for what you
> want, any SQL database would probably be fine, or even just Berkeley DB
> with a tied hash.

After a bit more digging, it looks more like Btree file may allow a closer
approximation of my current sendmail ruleset, since I found a newsgroup post
describing partial-matches available with that type of file.

My current sendmail rule looks like this:

	F{Subjects} -o /etc/mail/subjects
	HSubject:       $>CheckSubject

	SCheckSubject
	# do a full subject match scan
	R$={Subjects}$* $: REJECTSUBJECT
	# if no hits, re-scan for substrings
	R$* $={Subjects} $*     $: REJECTSUBJECT
	R$* REJECTSUBJECT $*    $#error $: "553 Access Denied - MSG may
contain SPAM/WORM/VIRUS/HOAX."

The rule as written, makes two passes to compare the subject to the loaded
list.  The first pass is for a perfect match, while the second pass performs
a substring match.

The newsgroup post that I refered to above, suggests the following would
work:

	In simple words you pass the $DB_BTree to the tie function and you
can
	iterate 

	tie %mydb,DB_File,"databasefile",O_RDWR|O_CREAT,0666,$DB_BTREE;

	my $key="partial key";
	my $value;

	my $search;
	for($search=$mydb->set($key,$value,R_CURSOR);$search==0;
		     $seach=mydb->set($key,$value,R_NEXT);
		     print("$key -- $value");

Does anyone have any opinions, or experience doing this kind of thing to
inspect $Subject from within filter_begin?

Ken



