[Mimedefang] http link only emails
David F. Skoll
dfs at roaringpenguin.com
Thu Jun 20 10:18:57 EDT 2002
Following up to myself:
> > I've just started receiving http linked emails.
I block any e-mail containing HTML unless my name "dfs at roaringpenguin.com"
appears in the "To:" header. This stops quite a bit of spam even before
it gets to SpamAssassin. Here's the code:
sub filter_begin () {
# Allow HTML from certain senders
if ($Sender eq '<xxxxx at yyyyy.zzz.xx>' || $Sender =~ /list-im-on/ || $Sender =~ /another-list/) {
$HTMLOK = 1;
} else {
$HTMLOK = 0;
}
# Accept HTML if we appear in the To: field
if (open(HDRS, "<./HEADERS")) {
while(<HDRS>) {
if (/^To:.*\@.*roaringpenguin\.com/i) {
$HTMLOK = 1;
}
if (/^Cc:.*\@.*roaringpenguin\.com/i) {
$HTMLOK = 1;
}
}
close(HDRS);
}
}
sub filter {
my($entity, $fname, $ext, $type) = @_;
#...
if ($lc_type eq "text/html" && !$HTMLOK) {
syslog('info', "$MsgID from $Sender via $RelayAddr ($RelayHostname) re: ($Subject) bounced because of HTML");
return action_bounce("HTML e-mail not accepted; please use plain text only.");
}
}
--
David.
More information about the MIMEDefang
mailing list