Exim
使用 exim4 添加 X-Spam-Flag
我是 exim4 的新手。我有這個配置:
.ifdef SA_ENABLE warn !authenticated = * hosts = !127.0.0.1/24 condition = ${if < {$message_size}{1K}} spam = SA_SPAMD_USER:true add_header = X-Spam_score: $spam_score\n\ X-Spam_score_int: $spam_score_int\n\ X-Spam_bar: $spam_bar\n\ X-Spam_report: $spam_report warn !authenticated = * hosts = !+relay_from_hosts spam = SA_SPAMD_USER:true/defer_ok add_header = X-Spam_score: $spam_score\n\ X-Spam_score_int: $spam_score_int\n\ X-Spam_bar: $spam_bar\n\ X-Spam_report: $spam_report set acl_m4 = $spam_score_int condition = ${if and{{<{$message_size}{100K}}{<{$acl_m4}{SA_SCORE_REJECT}}} {yes}{no}} logwrite = From $sender_address to $recipients X-Spam_score: $acl_m4. deny condition = ${if and{{>{$message_size}{10K}}{!eq{$acl_m4}{}}{>{$acl_m4}{SA_SCORE_REJECT}}} {yes}{no}} message = Content analisis tool detect spam (from $sender_address to $recipients). Contact SA_ABUSE_ADDR. .endif
如果分數超過/低於某個值,我如何調整添加 X-Spam-Flag(是或否),如果超過另一個值則拒絕。(目前 SA_SCORE_REJECT = 50)
如果我想強制執行兩個單獨條件的 AND,我發現將它們寫成兩個單獨的條件子句更清楚。我認為這會起作用:
# Define constants SA_MESSAGE_SIZE=100K SA_SCORE_FLAG=50 SA_SCORE_REJECT=100
和
.ifdef SA_ENABLE warn !authenticated = * hosts = !127.0.0.0/8 : !+relay_from_hosts condition = ${if <{$message_size}{SA_MESSAGE_SIZE}} spam = SA_SPAMD_USER:true set acl_m4 = $spam_score_int add_header = X-Spam_score: $spam_score\n\ X-Spam_score_int: $spam_score_int\n\ X-Spam_bar: $spam_bar\n\ X-Spam_report: $spam_report warn !authenticated = * hosts = !127.0.0.0/8 : !+relay_from_hosts condition = ${if <{$message_size}{SA_MESSAGE_SIZE}} condition = ${if >{$acl_m4}{SA_SCORE_FLAG}} add_header = X-Spam-Flag: YES logwrite = From $sender_address to $recipients X-Spam_score: $acl_m4. # Reject spam messages with score*10 over SA_SCORE_REJECT=100 deny !authenticated = * hosts = !127.0.0.0/8 : !+relay_from_hosts message = Content analysis tool detect spam (from $sender_address to $recipients). Contact SA_ABUSE_ADDR. condition = ${if <{$message_size}{SA_MESSAGE_SIZE}} condition = ${if >{$acl_m4}{SA_SCORE_REJECT}} logwrite = From $sender_address to $recipients spam message was rejected X-Spam_score: $acl_m4. .endif
$ spam_score_int=100 is equal $ spam_score=10.0