无法匹配 spamassassin 自定义正则表达式规则
Cannot match spamassassin custom regex rule
我想在我的 spamassassin 过滤规则中匹配这个模式:
Password archivio: 666
Per conto di:
di:后面有一个space,可以是未定义的数字。
在我的 custom.cf 中,我创建了这条规则
body CUSTOM_SPAM_RULE /Password\sarchivio:\s\d+\n\n\nPer\sconto\sdi:\s/
score CUSTOM_SPAM_RULE 99.9
describe CUSTOM_SPAM_RULE Regola di spam custom
我已经使用在线工具检查了正则表达式并且可以正常工作,您可以在这里检查 https://regex101.com/r/O3BfDK/1 但是我的邮件网关没有命中,如果我更改规则,服务器端配置可以正常工作到像 \test\ 这样的简单正则表达式并发送一封包含测试的正文的电子邮件,我可以清楚地看到点击率。那么,我缺少什么?
确定在 spamassassin 的官方文档中找到了它
Rawbody rules Rawbody rules allow you to search the body of the email without certain kinds of preprocessing that SA normally does
before trying body rules. In particular HTML tags won't be stripped
and line breaks will still be present. This allows you to create rules
searching for HTML tags or HTML comments that are signs of spam or
nonspam, or particular patterns of line-break.
所以正确的规则变成了
rawbody CUSTOM_SPAM_RULE /Password\sarchivio:\s\d+\n\n\nPer\sconto\sdi:\s/
score CUSTOM_SPAM_RULE 99.9
describe CUSTOM_SPAM_RULE Regola di spam custom
我想在我的 spamassassin 过滤规则中匹配这个模式:
Password archivio: 666
Per conto di:
di:后面有一个space,可以是未定义的数字。 在我的 custom.cf 中,我创建了这条规则
body CUSTOM_SPAM_RULE /Password\sarchivio:\s\d+\n\n\nPer\sconto\sdi:\s/
score CUSTOM_SPAM_RULE 99.9
describe CUSTOM_SPAM_RULE Regola di spam custom
我已经使用在线工具检查了正则表达式并且可以正常工作,您可以在这里检查 https://regex101.com/r/O3BfDK/1 但是我的邮件网关没有命中,如果我更改规则,服务器端配置可以正常工作到像 \test\ 这样的简单正则表达式并发送一封包含测试的正文的电子邮件,我可以清楚地看到点击率。那么,我缺少什么?
确定在 spamassassin 的官方文档中找到了它
Rawbody rules Rawbody rules allow you to search the body of the email without certain kinds of preprocessing that SA normally does before trying body rules. In particular HTML tags won't be stripped and line breaks will still be present. This allows you to create rules searching for HTML tags or HTML comments that are signs of spam or nonspam, or particular patterns of line-break.
所以正确的规则变成了
rawbody CUSTOM_SPAM_RULE /Password\sarchivio:\s\d+\n\n\nPer\sconto\sdi:\s/
score CUSTOM_SPAM_RULE 99.9
describe CUSTOM_SPAM_RULE Regola di spam custom