Browse Source

#626 configure Dovecot to move emails marked as spam by RSpamD to Junk folder.

Pavel Karoukin 8 years ago
parent
commit
76296f3440

+ 5
- 0
roles/mailserver/files/etc_dovecot_conf.d_90-sieve.conf View File

1
+plugin {
2
+  sieve = ~/.dovecot.sieve
3
+  sieve_dir = ~/sieve
4
+  sieve_before = /etc/dovecot/sieve/before.d
5
+}

+ 8
- 0
roles/mailserver/files/etc_dovecot_sieve_before.d_no-spam.sieve View File

1
+require "fileinto";
2
+require "imap4flags";
3
+
4
+if header :is "X-Spam" "Yes" {
5
+    setflag "\\seen";
6
+    fileinto "Junk";
7
+    stop;
8
+}

+ 5
- 0
roles/mailserver/tasks/dovecot.yml View File

32
 - name: Copy dovecot.conf into place
32
 - name: Copy dovecot.conf into place
33
   copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf
33
   copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf
34
 
34
 
35
+- name: Configure sieve script moving spam into Junk folder
36
+  copy: src=etc_dovecot_sieve_before.d_no-spam.sieve dest=/etc/dovecot/sieve/before.d/no-spam.sieve owner=vmail group=dovecot
37
+  notify: restart dovecot
38
+
35
 - name: Copy additional Dovecot configuration files in place
39
 - name: Copy additional Dovecot configuration files in place
36
   copy: src=etc_dovecot_conf.d_{{ item }} dest=/etc/dovecot/conf.d/{{ item }}
40
   copy: src=etc_dovecot_conf.d_{{ item }} dest=/etc/dovecot/conf.d/{{ item }}
37
   with_items:
41
   with_items:
38
     - 10-auth.conf
42
     - 10-auth.conf
39
     - 10-mail.conf
43
     - 10-mail.conf
40
     - 10-master.conf
44
     - 10-master.conf
45
+    - 90-sieve.conf
41
     - auth-sql.conf.ext
46
     - auth-sql.conf.ext
42
   notify: restart dovecot
47
   notify: restart dovecot
43
 
48
 

Loading…
Cancel
Save