Last active
January 26, 2026 21:36
-
-
Save dmckeone/b321fa81a37fe902013aa476749f5a26 to your computer and use it in GitHub Desktop.
Dovecot 2.4 sieve for automatically filing rspamd spam into the Junk folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require ["fileinto", "mailbox", "spamtest", "spamtestplus", "relational", "comparator-i;ascii-numeric"]; | |
| # See dovecot.conf for matching configuration: https://gist.github.com/dmckeone/7cdf170624d77c4ddcdce1721c6f760e | |
| # This configuration is intended to be used with Jinja2, so all variables look like: {{ variable }} | |
| # Must install spamtest & spamtestplus and normalize spam headers in dovecot.conf: https://doc.dovecot.org/main/core/config/sieve/extensions/spamtest_virustest.html | |
| # :percent normalizes the rspamd score ratio to a percent, so "X-Spamd-Result: default: False [12.00 / 15.00]" would be 12 / 15 = 0.8 or 80%. | |
| # | |
| # Don't create INBOX/Junk; only sort mail if it already exists | |
| if mailboxexists "INBOX/Junk" { | |
| if spamtest :percent :value "eq" :comparator "i;ascii-numeric" "100" { | |
| # spamtest returned 100% (spam) | |
| fileinto :create "INBOX/Junk"; | |
| stop; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment