From ddc53fbccc185bc52adf1050a98531c3750bf1fd Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 5 Mar 2018 22:50:50 +0800 Subject: mail: setup dovecot sevice --- roles/mail/files/sieve/after.d/50-spam.sieve | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 roles/mail/files/sieve/after.d/50-spam.sieve (limited to 'roles/mail/files/sieve/after.d/50-spam.sieve') diff --git a/roles/mail/files/sieve/after.d/50-spam.sieve b/roles/mail/files/sieve/after.d/50-spam.sieve new file mode 100644 index 0000000..3d48337 --- /dev/null +++ b/roles/mail/files/sieve/after.d/50-spam.sieve @@ -0,0 +1,32 @@ +# +# /usr/local/etc/dovecot/sieve/after.d/50-spam.sieve +# +# Global filters to filter spams. +# +# See: https://wiki.dovecot.org/Pigeonhole/Sieve +# +# Aaron LI +# 2017-04-24 +# + + +# fileinto: place messages into an IMAP folder other than INBOX +require "fileinto"; +# mailbox: create the IMAP folder if not exists +require "mailbox"; +# imap4flags: add IMAP flags to stored messages +require "imap4flags"; + + +# Just delete spams higher than level 10! +if header :contains "X-Spam-Level" "**********" { + discard; + stop; +} + +# Move SpamAssassin-tagged mails to "Junk" folder. +if header :contains "X-Spam-Flag" "YES" { + fileinto :create "Junk"; + setflag "\\Seen"; + stop; +} -- cgit v1.2.2