[Mimedefang] Administrator emails missing

Scott Harris scott at ozmatrix.com
Tue Dec 31 10:51:01 EST 2002


> Sorry; the logic in the sample filter is wrong.  The
> send_quarantine_notifications() must come AFTER any possible 
> quarantine actions.

Thanks David ... this fixed my problem.

Appreciation to Jason Englander & Jeffrey Thompson also.

Jeffrey's modified script now looks like this on my configuration using
MIMEDefang 2.28 ...

# If SpamAssassin found SPAM, append report.  We do it as a separate
# attachment of type text/plain

sub filter_end_aux ($) {
    my($entity) = @_;

# No sense doing any extra work
    return if message_rejected();

    # Spam checks if SpamAssassin is installed
    if ($Features{"SpamAssassin"}) {
        if (-s "./INPUTMSG" < 200*1024) {
            # Only scan messages smaller than 200kB.  Larger messages
            # are extremely unlikely to be spam, and SpamAssassin is
            # dreadfully slow on very large messages.
            my($hits, $req, $names, $report) = spam_assassin_check();
            if ($hits >= $req) {
                md_log('spam', $hits, $RelayAddr);
                my($score);
                if ($hits < 40) {
                    $score = "*" x int($hits);
                } else {
                    $score = "*" x 40;
                }

                # We add a header which looks like this:
                # X-Spam-Score: 6.8 (******) NAME_OF_TEST,NAME_OF_TEST
                # The number of asterisks in parens is the integer part
                # of the spam score clamped to a maximum of 40.
                # MUA filters can easily be written to trigger on a
                # minimum number of asterisks...
                #action_change_header("X-Spam-Score", "$hits ($score)
$names");
            
                action_add_header("X-Spam-Warning", "SpamAssassin says
this message is SPAM");
                action_add_header("X-Spam-Status", "Yes, hits=$hits
required=$req"); 
                action_add_header("X-Spam-Report","$report");
                } else {
                action_add_header("X-Spam-Status", "No");
                }
                # if we're quite confident it actually IS spam, just
bounce it
                if ($hits > 5) {
                $bounce = "yes";
                action_quarantine_entire_message();
                action_bounce("Message seems to be spam, rejected");
                }

                # If you find the SA report useful, add it, I guess...
                action_add_part($entity, "text/plain", "-suggest",
                                "$report\n",
                                "SpamAssassinReport.txt", "inline");
            } else {
                # Delete any existing X-Spam-Score header?
                action_delete_header("X-Spam-Score");
            }


                # Now this is the real filter_end
                sub filter_end ($) {
                my($entity) = @_;

                # Do the real work
                filter_end_aux($entity);

                # And send notifications
                send_quarantine_notifications();
                }

    }
}

# DO NOT delete the next line, or Perl will complain.
1;


Happy New Year !!!

:)

Scott




More information about the MIMEDefang mailing list