通过虚拟用户首选项的Exim 4筛选SpamAssassin

我想在acl_check_data config部分configurationexim的内置垃圾邮件filter支持来configuration垃圾邮件过滤。

pipe道,exim头修改(存储结果)效果很好。 以及通过dovecot-lda将邮件传输到Junk文件夹。

我唯一的问题是,我不能通过收件人的虚拟用户spamassassin让垃圾邮件从sql加载用户的喜好。

我知道,exim的“垃圾邮件”关键字左侧是为了这个,但它并没有通过任何变数。 只有静态值:简单地忽略我设置的所有variables。

这是我的configuration部分:

acl_check_data: # Deny if the message contains a virus. Before enabling this check, you # must install a virus scanner and set the av_scanner option above. # deny malware = * message = This message contains a virus ($malware_name). # Add headers to a message if it is judged to be spam. Before enabling this, # you must install SpamAssassin. You may also need to set the spamd_address # option above. # {def:h_Envelope-to:} # Accept when mail size is over 500k accept condition = ${if >={$message_size}{500k}{yes}{no}} # put headers in all messages (no matter if spam or not) warn spam = ${local_part}@${domain}:true add_header = X-Spam-Score: $spam_score\n\ X-Spam-Score-Int: $spam_score_int\n\ X-Spam-Level: $spam_bar\n\ X-Spam-Report: $spam_report # add second subject line with *SPAM* marker when message # is over threshold warn message = Classified as spam. spam = ${local_part}@${domain} add_header = X-Spam-Flag: YES\n\ Subject: [SPAM] $h_Subject: # reject spam at high scores (> 12) deny message = This message scored $spam_score spam points. spam = ${local_part}@${domain}:true condition = ${if >{$spam_score_int}{120}{true}{false}} # Accept the message. accept 

目前的forms是“$ {local_part} @ $ {domain}”,但我尝试了更多的:$ {local_part @ $ domain},带引号,没有括号等等。只有at符号(@)通过,而variables的工作其他关键字(例如条件)。

我知道,我可以做一个(资源饥饿)运输钩子,甚至过滤鸽子,但是我想使用这个function,如果可能的话。 所以请不要build议其他解决scheme,我知道他们。

你想做什么是根本不可能的。 在SMTP时检查垃圾邮件是禁止的,因为你最终会在索姆默扫描一个邮件(这样一次扫描),其中将包含多个收件人…你会加载哪个用户偏好? 为了做到这一点,您需要在交货时使用pipe道传输(垃圾邮件),而不是在SMTP时间。 在任何情况下,在SMTP时间使用大量的垃圾邮件检测(如spamassassin)是一个坏主意,因为它使您的服务器容易受到DoS攻击。 在SMTP时间使用较轻的垃圾邮件检测,在交付时使用较重的邮件(适合每个用户的规则)。