我将 mimedefang 与 spamassassin 和 sendmail 结合使用,如果邮件没有被拒绝为垃圾邮件,我可以通过将其添加到邮件头中来查看邮件日志中的分数和测试。
我希望在邮件被拒绝时在邮件日志中看到相同的信息。必须将其记录到邮件日志中,因为将其放在邮件头中对被拒绝的邮件不起作用。以下是未被拒绝的邮件日志的一部分,我希望在邮件日志中看到相同的信息。
v9D6s0vS026180: Milter add: header: X-Spam-Status: No, hits=-0.325 required=5 HEADER_FROM_DIFFERENT_DOMAINS,HTML_FONT_LOW_CONTRAST,HTML_MESSAGE,RP_MATCHES_RCVD,T_DKIM_INVALID
这是我的 mimedefang 配置
我已经启用了
md_graphdefang_log_enable('mail', 1);
这是我处理拒绝的部分
# Spam checks if SpamAssassin is installed
if ($Features{"SpamAssassin"}) {
if (-s "./INPUTMSG" < 100*1024) {
# Only scan messages smaller than 100kB. 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();
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...
if ($hits >= $req) {
return action_bounce("REJECT SPAMD This message is deemed to be SPAM");
md_graphdefang_log('spam', $hits, $names, $RelayAddr);
} else {
# Delete any existing X-Spam-Score header?
#action_delete_header("X-Spam-Score");
action_add_header("X-Spam-Status", "No, hits=$hits required=$req $names");
}
}
}
答案1
称呼md_graphdefang_log
前您可以filter_end
通过 退出子程序return
。
BTWmd_graphdefang_log
仅采用三个(3)个参数。