[Mimedefang] RE: filter question

M Jerome Garrett jgarrett at techsolutions.cc
Fri Sep 9 00:57:42 EDT 2005


Try something like this and put all the "opt-out" address in the
whitelist.db file.  Call the routine like this.

$auto_whitelist = 0;

if (lookup_whitelist()) {
    $auto_whitelist = 1;
    }

Then add this to the filter end area after the spam assassin checks and
before the tagging lines.
If ($auto_whitelist > 0) {
   $hits = 0;
    }



$DBFilenameWhitelist = "/etc/mail/whitelist.db";
sub lookup_whitelist() {
    my $sender_result = 0;

    my %GDB;
    if (tie(%GDB,'DB_File', $DBFilenameWhitelist, O_RDONLY)) {
        if ($GDB{$Sender}) {
                $sender_result = 1;
                md_graphdefang_log("Sender_Line", "Sender-line found in
whitelist.db");
        }
        untie %GDB;

    } else {
        md_syslog('warning', "sender: Cannot open file
$DBFilenameWhitelist");
    }
    return $sender_result;
}


Don't forget to make the whitelist.db file in the /etc/mail folder by doing
makemap -f hash /etc/mail/whitelist.db < (source file)

The source file should look like this:

<hehe at blau.com>	Accept
<anotheremail at addy.com>  ACCEPT






More information about the MIMEDefang mailing list