summaryrefslogtreecommitdiffstats
path: root/pigeonhole/examples/jerry.sieve
blob: ff8a92232f06f6f717f831290278cb79defb459e (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# Example Sieve Script
#   Author: Jerry
#   URL: http://www.emaildiscussions.com/showthread.php?postid=145322#post145322

require ["fileinto", "reject", "vacation", "regex", "relational",
"comparator-i;ascii-numeric"];


#### BLACKLIST - BOUNCE ANYTHING THAT MATCHES
#    From individual addresses
         if header :contains "from"
         [
           "username@example.com",
           "username@example.net"
         ]
         { reject "Message bounced by server content filter"; stop; }

#    From domains
         elsif header :contains "from"
         [
           "example.com",
           "example.net"
         ]
         { reject "Message bounced by server content filter"; stop; }



#### BLACKLIST - DELETE ANYTHING THAT MATCHES
#    From individual addresses
         elsif header :contains "from"
         [
           "username@example.com",
           "username@example.net"
         ]
         { discard; stop; }

#    From domains
         elsif header :contains "from"
         [
           "example.com",
           "example.net"
         ]
         { discard; stop; }

#    I just added the following section after the joe-job
#    that we all suffered at the hands of "inbox.com".
#    The "myusername" is MY username at FastMail.
#    DISCARDing this mail instead of directing it to a
#    SPAM folder kept me from going over quota repeatedly.

#    To individual addresses
         elsif header :contains "to"
         [
           "myusername@inbox.com",
           "myusername@example.net"
         ]
         { discard; stop; }

         elsif  allof
             (
                 not anyof
                 (
#### WHITELIST - KEEP ANYTHING THAT MATCHES
#    From individual addresses
                     header :contains "from"
                     [
                       "username@example.com",
                       "username@example.net"
                     ],

#    From trusted domains
                     header :contains "from"
                     [
                       "example.com",
                       "example.net"
                     ],

#    Specific "to" address (mailing lists etc)
                     header :contains ["to", "cc"]
                     [
                       "username@example.com",
                       "username@example.net"
                     ],

#    Specific "subject" keywords
                     header :contains "subject"
                     [
                       "code_word_for_friend_#1",
                       "code_word_for_friend_#2"
                     ]

                 ),
                 anyof
                 (

#    Filter by keywords in subject or from headers
                     header :contains ["subject", "from"]
                     [
                       "adilt", "adult", "advertise", "affordable",
                       "as seen on tv", "antenna", "alarm",
                       "background check", "bankrupt", "bargain",
                       "best price", "bikini", "boost reliability",
                       "brand new", "breast", "business directory",
                       "business opportunity", "based business", "best
                       deal", "bachelor's", "benefits", "cable",
                       "career", "casino", "celeb", "cheapest", "child
                       support", "cd-r", "catalog", "classified ad",
                       "click here", "coed", "classmate", "commerce",
                       "congratulations", "credit", "cruise", "cds",
                       "complimentary", "columbia house", "crushlink",
                       "debt", "detective", "diploma", "directv",
                       "directtv", "dish", "dream vacation", "deluxe",
                       "drug", "dvds", "dvd movie", "doubleclick",
                       "digital tv", "erotic", "exciting new",
                       "equalamail", "fantastic business", "fat
                       burning", "financial independence", "finalist",
                       "for life", "financing", "fitness", "fixed
                       rate", "four reports", "free!", "free
                       business", "from home", "funds", "fbi know",
                       "fortune", "gambl", "getaway", "girls", "great
                       price", "guaranteed", "get big", "get large",
                       "giveaway", "hard core", "hardcore", "home
                       document imaging", "home employment directory",
                       "homeowner", "home owner", "homeworker", "home
                       security", "home video", "immediate release",
                       "information you requested", "income",
                       "inkjet", "insurance", "interest rate",
                       "invest", "internet connection", "join price",
                       "judicial judgment", "just released", "know
                       your rights", "legal", "license", "loan", "long
                       distance", "look great", "low interest",
                       "low-interest", "low rate", "lust", "lbs",
                       "make money", "market", "master card",
                       "mastercard", "meg web", "merchant account",
                       "millionaire", "mini-vacation", "mortgage",
                       "master's", "magazine", "nasty", "new car",
                       "nigeria", "nude", "nympho", "naked",
                       "obligation", "online business", "opportunity",
                       "pager", "paying too much", "pda", "penis",
                       "pennies", "pills", "porn", "pounds",
                       "pre-approved", "prescri", "prscri", "prize",
                       "prostate", "printer ink", "quote", "refinanc",
                       "remove fat", "removing fat", "reward",
                       "sales", "satellite", "saw your site",
                       "scrambler", "sex", "smoking", "snoring", "some
                       people succeed", "special invitation", "special
                       offer", "stock", "saving", "singles", "teen",
                       "ticket", "tired of", "truth about anyone",
                       "the best", "ucking", "unbelievable",
                       "uncensored", "uncollected", "unlimited", "USA
                       domains", "urgent", "valium", "viagra",
                       "venture capital", "virgin", "visa", "vitamin",
                       "waist", "wealth", "webcam", "weight", "win a",
                       "winner", "win one", "work smarter", "work at
                       home", "xxx", "younger", "your web site", "your
                       money", "your date is wait",
                       "!!!", "$", "%", "10K"
                     ],

#    Filter when the subject is all uppercase (no lowercase)
                     header :regex :comparator
                     "i;octet" "subject" "^[^[:lower:]]+$",

#    Filter using regular expressions on the subject
                     header :regex    "subject"
                     [
                       "start.+business", "live.+auction",
                       "discover.+card", "pay.+college", "apr$",
                       "apr[^[:alnum:]]", "adv[^[:alnum:]]",
                       "free.+(coupon|info|install|money)",
                       "free.+(phone|sample|test|trial)",
                       "(buy|sell).+(house|home)"
                     ],

#    Filter with tracker codes in the subject
                     header :regex    "subject"
                     "[[:space:].\-_]{4}#?\[?[[:alnum:]-]+\]?$",

#    Filter spam with no to/from address set
                     not exists    ["To", "From"],

#    Filter spam not addressed to me
#        Put here all of your own addresses (and alias) that you expect
#        mail addressed to.  I found a lot of my spam didn't have my
#        name in the TO or CC fields at all -- it must have been in the
#        BCC (which doesn't show in the headers).  I can still get BCC
#        mail from legitimate sources because everyone in my address
#        book is on the WHITELIST above.

                     not header :contains ["to", "cc"]
                     [
                       "myusername@example.com",
                       "myusername@example.net"
                     ]

                 )
             )
         { fileinto "INBOX.1_spam"; }



#### Virus Filter
         elsif  header :contains ["subject", "from"]
         [
           "infected file rejected",
           "infected file rejected"
         ]
         { fileinto "INBOX.1_virus"; }


#### Telephone Alerts
#        Any message that gets this far should not be spam,
#        and a copy gets sent to my cell-phone as a TEXT message.

         elsif  header :contains ["to", "cc"]
         [
           "myusername@example.com",
           "myaliasname@example.com"
         ]
         { redirect "2135551234@mobile.example.net"; keep; }



# END OF SCRIPT