[Mimedefang] mimedefang subject filtering code
Jaco Minnaar
jaco at my-address.co.za
Wed Feb 18 08:08:55 EST 2004
Hi,
chane to: if ($idx == 0)
maybe also do my($idx) = index.......
you could also try if($line =~ m/^Subject: /) the you don't have to
define a "useless" var.
Jaco
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){ ---> 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