diff options
Diffstat (limited to 'ansible/roles/dovecot/files/dovecot/sieve/report-ham.sieve')
-rw-r--r-- | ansible/roles/dovecot/files/dovecot/sieve/report-ham.sieve | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ansible/roles/dovecot/files/dovecot/sieve/report-ham.sieve b/ansible/roles/dovecot/files/dovecot/sieve/report-ham.sieve new file mode 100644 index 0000000..2ad40aa --- /dev/null +++ b/ansible/roles/dovecot/files/dovecot/sieve/report-ham.sieve | |||
@@ -0,0 +1,23 @@ | |||
1 | require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"]; | ||
2 | |||
3 | if environment :matches "imap.mailbox" "*" { | ||
4 | set "mailbox" "${1}"; | ||
5 | } | ||
6 | |||
7 | # This line is important because when we delete from Junk/Spam, | ||
8 | # messages get moved to Trash, which tirggers the "message moved out of | ||
9 | # spam" script (this script) which—usually!—trains the originally classified | ||
10 | # Spam as not-spam. | ||
11 | # BUT, this is just a delete! If we train our spam as not-spam on delete, that | ||
12 | # defeats our goals. | ||
13 | # In short, this always gets run on a message being moved out of Spam, but if | ||
14 | # the target mailbox is Trash, just don't run the trainer this time. | ||
15 | if string "${mailbox}" "Trash" { | ||
16 | stop; | ||
17 | } | ||
18 | |||
19 | if environment :matches "imap.email" "*" { | ||
20 | set "email" "${1}"; | ||
21 | } | ||
22 | |||
23 | pipe :copy "train-ham.sh" [ "${email}" ]; | ||