[Mimedefang] Counting mail traffic

Егор Москвичев jugr at mail.ru
Tue Apr 13 08:20:24 EDT 2004


Hello!
I tried to count mail traffic with MIMEDefang. Everything goes fine but
sometimes i see empty strings in my maillog file, such as:
Tue Apr 13 19:58:54 2004
42080
There is no ip and recipient.
How can i solve this problem?
See my minedefang-filter below.
Thanx!

Egor Moskvichev

$SALocalTestsOnly = 0;
sub filter_recipient () {
    my ($recipient, $sender, $ip, $hostname, $first, $helo, $rcpt_mailer,
$rcpt_host, $rcpt_addr) = @_;
    $billing_from = $ip;
    $billing_to = $recipient;
    return ('CONTINUE', "ok");
};
sub filter_begin () {
    $billing_time = scalar(localtime);
    $billing_size = -s "./INPUTMSG";
    open(LOG, ">> /usr/local/billing/maillog");
    printf LOG "%-30s %-20s %-50s %-10s\n", ($billing_time, $billing_from,
$billing_to, $billing_size);
    close(LOG);
    my($hits, $req, $names, $report) = spam_assassin_check();
    if ($hits >= $req) {
 action_add_header("X-Spam-Flag", "YES");
 action_add_header("X-Spam-Status", "Yes, hits=$hits, required=$req,
tests=$names");
 action_change_header("Subject", "** SPAM ** $Subject");
    } else {
 action_add_header("X-Spam-Status", "No, hits=$hits, required=$req,
tests=$names");
    };
};
1;



More information about the MIMEDefang mailing list