aboutsummaryrefslogtreecommitdiff
path: root/mailfilter.dot.link
blob: fe137f9bcb4d4eb11d790da462ca9a6cfe08e53b (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#
# Maildrop rules
#
# See http://www.wonkity.com/~wblock/docs/html/maildrop.html
#     https://github.com/QMailToaster/maildrop/blob/master/mailfilter
#     https://we.riseup.net/debian/maildrop
#
# regex flags, used after the regex: /something/:b
# :h - header
# :b - body
# :D - distinguish between upper and lower case (default is to ignore case)

#
# Basic parameters
#

TYPE="maildir"
BASE="$HOME/mail"
DEFAULT="$BASE/INBOX"

#
# Logging
#

logfile "$HOME/temp/log/maildrop"

#
# SPAM handling
#

# Send mail through bogofilter
xfilter "/usr/bin/bogofilter -uep"

# Put mail bogofilter deems as spam in spam folder
if (/^X-Bogosity: Spam, tests=bogofilter/)
  to $BASE/INBOX.Trash

# Put mail bogofilter deems as unsure in spam folder
#if (/^X-Bogosity: Unsure, tests=bogofilter/)
#  to $BASE/INBOX.Trash

if (/^X-Spam-Level: \*\*\*\*\*\*/)
  to $BASE/INBOX.Trash

if (/^X-Spam-Flag: YES/)
  to $BASE/INBOX.Trash

if (/^X-Bogosity:.*Yes/)
  to $BASE/INBOX.Trash

if (/^X-Bogosity: Spam.*/)
  to $BASE/INBOX.Trash

#if (/^Subject:.*\*\*\*SPAM\*\*\*/)
#  to $BASE/INBOX.Trash

if (/^Subject:.*(SPAM)/)
  to $BASE/INBOX.Trash

#
# Custom recipes
#

# Test for a custom maildrop configuration
`test -r $HOME/.custom/mailfilter`

# Includes an existing maildrop configuration
if ($RETURNCODE == 0)
{
  log "Including $HOME/.custom/mailfilter"
  exception {
    include $HOME/.custom/mailfilter
  }
}