Skip to content

Instantly share code, notes, and snippets.

@dmckeone
Last active January 26, 2026 21:36
Show Gist options
  • Select an option

  • Save dmckeone/1b9cc69dba8d3435986dbe8b87070417 to your computer and use it in GitHub Desktop.

Select an option

Save dmckeone/1b9cc69dba8d3435986dbe8b87070417 to your computer and use it in GitHub Desktop.
Dovecot 2.4 sieve for sending rspamd Ham education to a relay/gateway
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables", "imap4flags"];
# 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 }}
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
# If moving from Junk to Trash then the email is being deleted, not marked as ham
if string :matches "${mailbox}" ["*/Trash", "Trash"] {
stop;
}
if environment :matches "imap.user" "*" {
set "username" "${1}";
}
pipe :copy "rspamc" ["-h", "{{ mail_relay }}", "-P", "{{ rspamd_password }}", "-d", "${username}", "learn_ham"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment