Browse Source

Merge pull request #635 from hippich/626-configure-dovecot-to-move-spam-to-junk-folder

#626 configure dovecot to move spam to junk folder
Luke Cyca 8 years ago
parent
commit
5266566d1a

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

@@ -0,0 +1,5 @@
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

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

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

@@ -32,12 +32,21 @@
32 32
 - name: Copy dovecot.conf into place
33 33
   copy: src=etc_dovecot_dovecot.conf dest=/etc/dovecot/dovecot.conf
34 34
 
35
+- name: Create before.d sieve scripts directory
36
+  file: path=/etc/dovecot/sieve/before.d state=directory owner=vmail group=dovecot recurse=yes mode=0770
37
+  notify: restart dovecot
38
+
39
+- name: Configure sieve script moving spam into Junk folder
40
+  copy: src=etc_dovecot_sieve_before.d_no-spam.sieve dest=/etc/dovecot/sieve/before.d/no-spam.sieve owner=vmail group=dovecot
41
+  notify: restart dovecot
42
+
35 43
 - name: Copy additional Dovecot configuration files in place
36 44
   copy: src=etc_dovecot_conf.d_{{ item }} dest=/etc/dovecot/conf.d/{{ item }}
37 45
   with_items:
38 46
     - 10-auth.conf
39 47
     - 10-mail.conf
40 48
     - 10-master.conf
49
+    - 90-sieve.conf
41 50
     - 90-antispam.conf
42 51
     - auth-sql.conf.ext
43 52
   notify: restart dovecot

Loading…
Cancel
Save