[Mimedefang] mimedefang subject filtering code
Andrew Jayes
andrew.jayes at visitheartofengland.com
Wed Feb 18 06:31:19 EST 2004
Hi,
The '#subject check' section of code is not working in my
filter, This is an exact copy of my filter begin. Do I need to define
the variables better and if so how? Or do I just have the code wrong?
Any help would be great.
#******************************************************************
sub filter_begin () {
# ALWAYS drop messages with suspicious chars in headers
if ($SuspiciousCharsInHeaders) {
md_graphdefang_log('suspicious_chars');
action_quarantine_entire_message("Message quarantined because of
suspicious characters in headers");
# Do NOT allow message to reach recipient(s)
return action_discard();
}
# Subject check
my($msgSubject);
my($hfile) = "HEADERS";
while(<HEADERS>) {
chomp;
$line = $_;
$idx = index($line, "Subject: ");
if (idx == 0){
$msgSubject = substr($line, 9);
}
}
if (($msgSubject =~ /RE: [A-Z] {2,},(?: [A-Z]+!?)+/) ||
($msgSubject =~ /\bparis hilton\b/ )) {
#Bounce the mail!
action_bounce("Forbiden subject matter - Rejected");
}
#******************************************************************
many thanks for looking,
andrew
More information about the MIMEDefang
mailing list