mail: put spam sieve scripts into /etc
This commit is contained in:
parent
a0f78133f6
commit
11b0903535
|
@ -53,6 +53,18 @@ in
|
|||
'';
|
||||
mode = "0555";
|
||||
};
|
||||
"dovecot/sieve/report-spam.sieve" = {
|
||||
source = ./report-spam.sieve;
|
||||
user = "dovecot2";
|
||||
group = "dovecot2";
|
||||
mode = "0544";
|
||||
};
|
||||
"dovecot/sieve/report-ham.sieve" = {
|
||||
source = ./report-ham.sieve;
|
||||
user = "dovecot2";
|
||||
group = "dovecot2";
|
||||
mode = "0544";
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
|
@ -229,13 +241,13 @@ in
|
|||
# Spam: From elsewhere to Spam folder or flag changed in Spam folder
|
||||
imapsieve_mailbox1_name = Spam
|
||||
imapsieve_mailbox1_causes = COPY APPEND FLAG
|
||||
imapsieve_mailbox1_before = file:/var/lib/dovecot/imap_sieve/report-spam.sieve
|
||||
imapsieve_mailbox1_before = file:/etc/dovecot/sieve/report-spam.sieve
|
||||
|
||||
# Ham: From Spam folder to elsewhere
|
||||
imapsieve_mailbox2_name = *
|
||||
imapsieve_mailbox2_from = Spam
|
||||
imapsieve_mailbox2_causes = COPY
|
||||
imapsieve_mailbox1_before = file:/var/lib/dovecot/imap_sieve/report-ham.sieve
|
||||
imapsieve_mailbox2_before = file:/etc/dovecot/sieve/report-ham.sieve
|
||||
}
|
||||
'';
|
||||
};
|
15
modules/mail/report-ham.sieve
Executable file
15
modules/mail/report-ham.sieve
Executable file
|
@ -0,0 +1,15 @@
|
|||
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 "sa-learn-ham.sh" [ "${username}" ];
|
7
modules/mail/report-spam.sieve
Executable file
7
modules/mail/report-spam.sieve
Executable file
|
@ -0,0 +1,7 @@
|
|||
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
|
||||
|
||||
if environment :matches "imap.user" "*" {
|
||||
set "username" "${1}";
|
||||
}
|
||||
|
||||
pipe :copy "sa-learn-spam.sh" [ "${username}" ];
|
Loading…
Reference in a new issue