diff options
-rw-r--r-- | modules/private/mail/dovecot.nix | 15 | ||||
-rw-r--r-- | modules/private/mail/sieve_scripts/backup.sieve | 9 |
2 files changed, 23 insertions, 1 deletions
diff --git a/modules/private/mail/dovecot.nix b/modules/private/mail/dovecot.nix index 6c3b4b8..f52f263 100644 --- a/modules/private/mail/dovecot.nix +++ b/modules/private/mail/dovecot.nix | |||
@@ -92,6 +92,17 @@ in | |||
92 | } | 92 | } |
93 | '' | 93 | '' |
94 | 94 | ||
95 | # ACL | ||
96 | '' | ||
97 | mail_plugins = $mail_plugins acl | ||
98 | plugin { | ||
99 | acl = vfile:${pkgs.writeText "dovecot-acl" '' | ||
100 | Backup/* owner lrp | ||
101 | ''} | ||
102 | acl_globals_only = yes | ||
103 | } | ||
104 | '' | ||
105 | |||
95 | # Full text search | 106 | # Full text search |
96 | '' | 107 | '' |
97 | # needs to be bigger than any mailbox size | 108 | # needs to be bigger than any mailbox size |
@@ -117,6 +128,8 @@ in | |||
117 | sieve_plugins = sieve_imapsieve sieve_extprograms | 128 | sieve_plugins = sieve_imapsieve sieve_extprograms |
118 | imapsieve_url = sieve://127.0.0.1:4190 | 129 | imapsieve_url = sieve://127.0.0.1:4190 |
119 | 130 | ||
131 | sieve_before = file:${./sieve_scripts}/backup.sieve | ||
132 | |||
120 | # From elsewhere to Junk folder | 133 | # From elsewhere to Junk folder |
121 | imapsieve_mailbox1_name = Junk | 134 | imapsieve_mailbox1_name = Junk |
122 | imapsieve_mailbox1_causes = COPY APPEND | 135 | imapsieve_mailbox1_causes = COPY APPEND |
@@ -225,7 +238,7 @@ in | |||
225 | # Needs to come last if there are mail_plugins entries | 238 | # Needs to come last if there are mail_plugins entries |
226 | '' | 239 | '' |
227 | protocol imap { | 240 | protocol imap { |
228 | mail_plugins = $mail_plugins imap_sieve | 241 | mail_plugins = $mail_plugins imap_sieve imap_acl |
229 | } | 242 | } |
230 | protocol lda { | 243 | protocol lda { |
231 | mail_plugins = $mail_plugins sieve | 244 | mail_plugins = $mail_plugins sieve |
diff --git a/modules/private/mail/sieve_scripts/backup.sieve b/modules/private/mail/sieve_scripts/backup.sieve new file mode 100644 index 0000000..c922999 --- /dev/null +++ b/modules/private/mail/sieve_scripts/backup.sieve | |||
@@ -0,0 +1,9 @@ | |||
1 | # vim: filetype=sieve | ||
2 | require ["copy","mailbox","fileinto","regex"]; | ||
3 | if not header :regex "subject" "^TestMailImmae ?$" { | ||
4 | if header :is "X-Spam" "Yes" { | ||
5 | fileinto :create :copy "Backup/Spam"; | ||
6 | } else { | ||
7 | fileinto :create :copy "Backup/Ham"; | ||
8 | } | ||
9 | } | ||