Exim和spamassassin自定义规则

我有eximspamassassin(由exiscan使用)安装和运行,但我想添加自定义规则,这将添加一些点的电子邮件,如果“到”和“信封到”不相同。 我在local.cf中添加了以下规则:

header EXIM_SENDER_SWAP X-Sender-Swap =~ /To_envelope-to/ describe EXIM_SENDER_SWAP To doesnt match envelope-to score EXIM_SENDER_SWAP 2.0 

并在exim.conf中input

  acl_check_data: warn message = X-Subject-Swap: To_envelope-to condition = ${if !match {${lc:$h_envelope-to:}}{${lc:$h_to:}}{yes}{no}} 

我正在发送testing消息,相应的头文件是由exim添加的,但没有额外的spamassassin添加的指针。 怎么了?

首先,“消息”修饰符不是你想要的,而是当你想在ACL中为消息添加一个头时,你想使用“add_header”。 阅读http://www.exim.org/exim-html-current/doc/html/spec_html/ch42.html#SECTaddheadacl如果你需要更多的信息,那部分。

但是,我不认为你所要做的将会比你所使用的方式工作。 在处理每个ACL的过程中,ACL运行,然后当ACL 完成时完成所有的头部添加和删除操作。 您在同一个DATA ACL中执行了这两个操作,这意味着第一次比较添加的头还没有真正添加到垃圾邮件命令正在扫描的临时文件中的邮件中。

一种select是进行垃圾邮件扫描,检测您添加标题的情况,然后在比较时将该分数添加到包含垃圾邮件分数的variables中,以查看是否为垃圾邮件。

第二个选项,我认为更好的select是让您使用两个不同的用户来运行垃圾邮件扫描。 对于你有一个垃圾邮件分数设置为(例如)5.0。 对于第二个,您将垃圾邮件分数设置为3.0。 这比正常限制less了2分,这与垃圾邮件分数增加了2分相同。

那么你的ACL节可能看起来像(未经testing):

 warn condition = ${if !match {${lc:$h_envelope-to:}}{${lc:$h_to:}}{yes}{no}} set $acl_m_env_ok = 1 spam = strict_user:true warn condtion = ${if eq{$acl_m_env_ok}{1} {no}{yes}} spam = normal_user:true warn add_header = X-Spam-Score: $spam_score add_header = X-Spam-Report: $spam_report deny condition = ${if eq{$acl_m_env_ok}{1}} condition = ${if >{$spam_score_int}{30}} message = This message with mismatched header/envelope score $spam_score_points...REJECTED deny condition = ${if >{$spam_score_int}{50}} message = This message scored $spam_score points...REJECTED