[Mimedefang] checking the body and the headers for strings?

Jonas Eckerman jonas_lists at frukt.org
Fri Feb 6 03:50:20 EST 2004


Please, use a mailer that handles threading.

>  Well, one reason is that in all my tests I found out that
>  Spamassasin tookup too much memory to operate

The one reason I listed in my answer. :-)

>  So how can I get those codes to work in mimedefang-filter?

Maybe something like this in filter_begin (note, the code below is completely untested and written before I've finished my first cup of coffee, don't trust it too much):

if (open (INF, "./HEADERS")) {
	my $bad = 0;
	while (my line = <INF>) {
		$line =~ s/\n//g;
		if ($line =~ /^Subject:\s+.*hastalavistababy.*$/) {
			$bad = 1;
			last;
		}
	}
	close(INF);
	return action_discard('Bad, bad header!') if ($bad);
}

if (open (INF, "./INPUTMSG")) {
	my $bad = 0;
	while (my line = <INF>) {
		$line =~ s/\n//g;
		if ($line =~ /hastalavistababy/) {
			$bad = 1;
			last;
		}
	}
	close(INF);
	return action_discard('Bad, bad body!') if ($bad);
}

Regards
/Jonas

-- 
Jonas Eckerman, jonas_lists at frukt.org
http://www.fsdb.org/




More information about the MIMEDefang mailing list