aboutsummaryrefslogtreecommitdiffstats
path: root/roles/mail/files/sieve/after.d/50-spam.sieve
blob: 3d483376ae288b486bd78f07427c92d4b2b08407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
}