mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2024-11-15 05:13:10 +01:00
mail: put sieve scripts in /etc
This commit is contained in:
parent
9f90c1643a
commit
74a4348d1d
|
@ -41,6 +41,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 = {
|
||||
|
@ -176,13 +188,14 @@ 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
|
||||
# From Junk 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
hosts/falkenstein-1/modules/mail/report-ham.sieve
Normal file
15
hosts/falkenstein-1/modules/mail/report-ham.sieve
Normal 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
hosts/falkenstein-1/modules/mail/report-spam.sieve
Normal file
7
hosts/falkenstein-1/modules/mail/report-spam.sieve
Normal 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