diff --git a/scripts/dovecot/rspamd-learn-ham.sh.mustache b/scripts/dovecot/rspamd-learn-ham.sh.mustache new file mode 100644 index 0000000..0a2b867 --- /dev/null +++ b/scripts/dovecot/rspamd-learn-ham.sh.mustache @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/rspamc -h localhost:11334 learn_ham diff --git a/scripts/dovecot/rspamd-learn-ham.sieve.mustache b/scripts/dovecot/rspamd-learn-ham.sieve.mustache new file mode 100644 index 0000000..efa65c8 --- /dev/null +++ b/scripts/dovecot/rspamd-learn-ham.sieve.mustache @@ -0,0 +1,16 @@ +require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; + +if environment :matches "imap.mailbox" "*" { + set "mailbox" "${1}"; +} + +if string "${mailbox}" "Trash" { + stop; +} + +if environment :matches "imap.user" "*" { + set "username" "${1}"; +} + +pipe :copy "rspamd-learn-ham.sh" [ "${username}" ]; + diff --git a/scripts/dovecot/rspamd-learn-spam.sh.mustache b/scripts/dovecot/rspamd-learn-spam.sh.mustache new file mode 100644 index 0000000..629fdb4 --- /dev/null +++ b/scripts/dovecot/rspamd-learn-spam.sh.mustache @@ -0,0 +1,3 @@ +#!/bin/sh +exec /usr/bin/rspamc -h localhost:11334 learn_spam + diff --git a/scripts/dovecot/rspamd-learn-spam.sieve.mustache b/scripts/dovecot/rspamd-learn-spam.sieve.mustache new file mode 100644 index 0000000..47c0dd0 --- /dev/null +++ b/scripts/dovecot/rspamd-learn-spam.sieve.mustache @@ -0,0 +1,8 @@ +require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; + +if environment :matches "imap.user" "*" { + set "username" "${1}"; +} + +pipe :copy "rspamd-learn-spam.sh" [ "${username}" ]; +