[Mimedefang] still struggling with syntax erro in mimedefang-filter

tonj tonj at freeuk.com
Wed Jun 16 10:52:25 EDT 2010

further to my previous post I still can't get rid of the syntax error in my 
mimedefang-filter for rejecting html email.  If you can see the error could 
you please clarify what it is and what the correct syntax would be. Thanks 
for any help and my md filter contains this:

# Detect and load Perl modules

sub filter_begin {
    my($entity) = @_;
    if ($FoundHTML  && {
        action_bounce("HTML mail not allowed here.");
sub filter_end {
    my($entity) = @_;
    my($hits, $req, $names, $report) = spam_assassin_check();
    my $stars = ($hits < 15) ? ("*" x int($hits)) : ("*" x 15);

    # Bounce anything hitting the spam threshold
    if ($hits >= 5) {
        action_bounce("No spam wanted here.");

    # Add spam-score header
    action_change_header("X-Spam-Score", "$hits ($stars) $names");
# DO NOT delete the next line, or Perl will complain.

the syntax error says:
syntax error at /etc/mail/mimedefang-filter line 8, near "return"
syntax error at /etc/mail/mimedefang-filter line 10, near "}"
Compilation failed in require at /usr/bin/mimedefang.pl line 5257. 

More information about the MIMEDefang mailing list