【问题标题】:Check whether at least two out of three procmail conditions are true检查三个 procmail 条件中是否至少有两个为真
【发布时间】:2016-07-15 11:10:50
【问题描述】:

如何在 procmail 中检查是否至少有三分之二的垃圾邮件过滤器将邮件视为垃圾邮件?由于对垃圾邮件标头的多次检查,我不想有重复的代码。

# Invoke bogofilter
:0 fw
| bogofilter -C -d /home/shared_directories/bogofilter -p -e

# Invoke bmf
:0 fw
| bmf -d /home/shared_directories/bmf -f text -p

# Invoke spambayes
:0 fw
| sb_filter -d /home/shared_directories/spambayes

# If two out of three filters agree it's spam, file it.
:0
* ^X-Bogosity: Spam
* ^X-Spam-Status: Yes
* ^X-Spambayes-Classification: spam
{
# Process the mail
}

【问题讨论】:

    标签: procmail


    【解决方案1】:

    您可以使用基本分数为 -1 的评分。

    :0
    * -1^0
    *  1^0 ^X-Bogosity: Spam
    *  1^0 ^X-Spam-Status: Yes
    *  1^0 ^X-Spambayes-Classification: spam
    {
      # ... stuff
    

    如果单个条件匹配,则分数只会归零,因此复合结果不匹配。如果两个或多个单独条件使分数高于零,则采取行动。

    procmailsc manual page 解释了这种机制。它的使用不是很广泛,并且有许多复杂性,但基础知识简单明了。

    【讨论】:

      猜你喜欢
      • 2011-03-05
      • 2015-09-22
      • 2017-10-06
      • 1970-01-01
      • 2019-05-22
      • 2021-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多