require [ "vnd.dovecot.filter"]; require [ "spamtest", "relational", "comparator-i;ascii-numeric" ]; require [ "fileinto", "mailbox" ]; require [ "vnd.dovecot.debug" ]; filter "spamc" [ "--no-safe-fallback" ]; if header :contains "X-Spam-Status" "score" { debug_log "X-Spam-Status header present and contains 'score'"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "0" { debug_log "spamtest found no match!"; } elsif spamtest :value "ge" :comparator "i;ascii-numeric" "2" { if spamtest :value "eq" :comparator "i;ascii-numeric" "1" { debug_log "spamtest value == 1"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "2" { debug_log "spamtest value == 2"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "3" { debug_log "spamtest value == 3"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "4" { debug_log "spamtest value == 4"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "5" { debug_log "spamtest value == 5"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "6" { debug_log "spamtest value == 6"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "7" { debug_log "spamtest value == 7"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "8" { debug_log "spamtest value == 8"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "9" { debug_log "spamtest value == 9"; } if spamtest :value "eq" :comparator "i;ascii-numeric" "10" { debug_log "spamtest value == 10"; } #if header "X-Spam-Flag" "YES" { if mailboxexists "Junk" { debug_log "file spam into existing mailbox 'Junk'"; fileinto "Junk"; } elsif mailboxexists "junk" { debug_log "file spam into existing mailbox 'junk'"; fileinto "junk"; } elsif mailboxexists "spam" { debug_log "file spam into existing mailbox 'spam'"; fileinto "spam"; } else { debug_log "file spam into mailbox 'Spam'"; fileinto :create "Spam"; } stop; debug_log "after stop"; } else { debug_log "spamtest asserts message free of spam"; }