-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.sieve
273 lines (242 loc) · 8.73 KB
/
rules.sieve
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", "mboxmetadata", "servermetadata", "date", "index", "comparator-i;ascii-numeric", "variables", "imap4flags", "editheader", "duplicate", "vacation-seconds", "fcc", "vnd.cyrus.jmapquery", "vnd.cyrus.log", "mailboxid", "special-use", "vnd.cyrus.snooze", "vnd.cyrus.imip"];
# Rule Skip - Contacts (but not auto-saved contacts)
if
jmapquery text:
{
"conditions" : [
{
"fromAnyContact" : true
},
{
"conditions" : [
{
"fromContactGroupId" : "<AUTOSAVED CONTACT GROUP ID>"
}
],
"operator" : "NOT"
}
],
"operator" : "AND"
}
.
{
set "flagged" "Y";
stop;
}
# Rule Skip rules - notifications [regular expressions + from]
if
anyof(
header :regex "Subject" "(?i)\\b(PIN|Verify|Verification|Confirm|One-Time|Single(-|\\s)Use)\\b.*?(passcode|number|code.*$)",
header :regex "Subject" "(?i)^.*upcoming (appointment|visit).*",
header :regex "Subject" "(?i)^.*new.*(sign(in|-in|ed)|(log(in|-in|ged)))",
header :regex "Subject" "(?i)^.*(meeting|visit|appointment|event).*\\b(reminder|notification)",
header :regex "Subject" "(?i)^.*verify.*(device|email|phone)",
header :regex "Subject" "(?i)^.*Apple.*(ID was used to sign in)",
header :regex "Subject" "(?i)^.*(computer|phone|device).*(added)",
header :regex "Subject" "(?i)^2FA.*(turned on)",
header :regex "Subject" "(?i)^.*confirm.*(you)",
header :regex "Subject" "(?i)^.*you.*((log|sign)\\s?-?\\s?in).*$",
header :regex "Subject" "(?i)^.*sign.*(in)"
)
{
stop;
}
# Rule Alerts [regular expressions]
if
anyof(
header :regex "Subject" "(?i)^(.*dependabot|.*security|.*advisor).*$",
header :regex "Subject" "\\b(?i)(uptime|downtime|outage|alert|PagerDuty).*\\b",
header :regex "Subject" "^(\\[URGENT\\] )?Certificate (discovered|expiration) for (.+?)(?: and \\d+ other hosts)?(?: \\((\\d{2} \\w+ \\d{4})\\))?(\\s*\\[URGENT\\])?$"
)
{
fileinto "INBOX.Notifications";
setflag "\\Seen";
}
# Rule Forward - Reader [regular expression]
if
anyof(
header :regex "List-Id" "(?!www\\.)([a-zA-Z0-9-]+)\\.substack\\.com",
header :regex "List-Id" "[a-zA-Z0-9-]+\\.buttondown\\.email"
)
{
setflag "\\Seen";
fileinto "INBOX.Forwarded.Reader";
#redirect :copy "<YOUR_READER_EMAIL>"; #analyze, then remove comment
stop;
}
# Rule Deliveries - no forward [regular expressions + glob patterns]
if
anyof(
address :regex "From" "usps|fedex|narvar|shipment-tracking|getconvey",
header :regex "From" "(^|,)[[:space:]]*\"?.?\\(ed.*x delivery manager\\|.*ed.*x\\.com\\|tracking.*updates.*\\)\"?[[:space:]]*<",
header :regex "Subject" "(?i)^.*package (has been?|was) delivered.*$"
)
{
fileinto "INBOX.Financial.Deliveries";
stop;
}
# Rule Deliveries [regular expressions]
if
allof (
anyof(
header :regex "Subject" "(?i)(ship(ped)?)|(.*a shipment (from|to).*(was|has) shipped.*)|((package|order) (is|has))|(track(ing)? .* your)"
),
anyof(
body :regex "(1Z)[0-9A-Z]{16}",
body :regex "(T)+[0-9A-Z]{10}",
body :regex "[0-9]{9}",
body :regex "[0-9]{26}",
body :regex "(94|93|92|94|95)[0-9]{20}",
body :regex "(94|93|92|94|95)[0-9]{22}",
body :regex "(70|14|23|03)[0-9]{14}",
body :regex "(M0|82)[0-9]{8}",
body :regex "([A-Z]{2})[0-9]{9}([A-Z]{2})",
body :regex "[0-9]{20}",
body :regex "[0-9]{15}",
body :regex "[0-9]{12}",
body :regex "[0-9]{22}"
)
)
{
setflag "\\Seen";
fileinto "INBOX.Financial.Deliveries";
#redirect :copy "<YOURPACKAGETRACKINGEMAIL>"; #analyze, then remove comment
stop;
}
# Rule Financial - promotions [regular expressions]
if
anyof(
address :regex "From" "(^.*store-news.*$|^.*axxess.*$)(\\b.*?|$)",
header :regex "Subject" "^(?=.*\\b(?i)(final offer|limited time|last chance|black friday|cyber monday|holiday|christmas|free shipping|send (gift|present))\\b).*\\b(?i)(discount|save|\\d+% off|free)\\b",
body :text :regex "\\b\\d{1,2}(?:\\.\\d+)?% off\\b",
header :regex "Subject" "\\b(?i)(discount(ed)?|save|\\d+% off|free)\\b"
)
{
fileinto "INBOX.Financial.Promotions";
stop;
}
# Rule Financial - travel forward [regular expressions]
if
header :regex "Subject" "\\b(?i)(flight|confirmation|you're going to).*\\b(reservation|on)\\b"
{
setflag "\\Seen";
fileinto "INBOX.Financial.Travel";
#redirect :copy "[email protected]";
stop;
}
# Rule Financial - travel [regular expressions]
if
anyof(
header :regex "Subject" "\\b(?i)(hotel|reservation|booking|dining|restaurant|travel)(s)?( |-)?(confirmation|reservations?|bookings?|details)\\b",
header :regex "Subject" "\\b(?i)(uber|lyft|rideshare)(s)?( |-)?(receipt|confirmation|ride summary|your ride with)\\b"
)
{
fileinto "INBOX.Financial.Travel";
stop;
}
# Rule Financial - tickets [regular expressions]
if
header :regex "Subject" "\\b(?i)(concert|event|show|performance|ticket|admission|venue|registration)\\b"
{
fileinto "INBOX.Financial.Tickets";
stop;
}
# Rule Financial - media [regular expressions]
# TODO: change to use header detection, rather than From search
if
address :regex "From" "^(?i:Disneyplus.*$|Netflix.*$|^.*hulu.*$|HBOmax.*$|MoviesAnywhere.*$|iTunes.*$|7digital.*$|Bandcamp.*$|Roku.*$|Plex.*$|Peacock.*$|Peacocktv.*&)"
{
setflag "\\Seen";
fileinto "INBOX.Financial.Media";
stop;
}
# Rule Financial - taxes [regular expressions]
if
header :regex "Subject" "\\b(?i)(tax|taxes|taxation)(es)?( |-)?(year|years|season|deadline|form|return|refund|filing|audit|documents?)\\b(\\d{4})?"
{
setflag "\\Seen";
fileinto "INBOX.Financial.Taxes";
stop;
}
# Rule Financial [regular expressions + globs]
if
anyof(
body :text :regex "(?i)you(?:r)?[\\s-]*(?:pre[\\s-]?order|pre[\\s-]?order(?:ed))",
header :regex ["To","Cc"] "(^|,)[[:space:]]*\"?.*\\[Aa\\]\\[Pp\\]\\[Pp\\]\\[Ll\\]\\[Ee\\] \\[Cc\\]\\[Aa\\]\\[Rr\\]\\[Dd\\].*\\[Ss\\]\\[Uu\\]\\[Pp\\]\\[Pp\\]\\[Oo\\]\\[Rr\\]\\[Tt\\].*\"?[[:space:]]*<",
header :regex "Subject" "(?i)\\b(receipt|bill|invoice|transaction|statement|payment|order|subscription|authorized|booking|renew(al|ing)?|expir(e|ed|ing)?|deposit|withdrawal|purchased?|(itunes|apple) store|credit (score|report)|manage (account|loan))\\b.*",
header :regex "Subject" "(?i)\\b(gift (card|certificate)|zelle|new plan|autopay)\\b.*",
header :regex "Subject" "(?i).* paid .* \\$(\\d,?)+\\.\\d{2}"
)
{
fileinto "INBOX.Financial";
stop;
}
# Rule Notifications - privacy [regular expressions]
if
header :regex "Subject" "\\b(?i)(CCPA|California Consumer Privacy Act|privacy request|data privacy|personal data request|rights request)\\b"
{
setflag "\\Seen";
fileinto "INBOX.Notifications.Privacy";
stop;
}
# Rule DMARC [regular expressions]
if
anyof(
header :regex "Subject" "((^.*dmarc.*$)(\\b.*?|$))",
address :regex "From" "((^.*dmarc.*$)(\\b.*?|$))"
)
{
setflag "\\Seen";
fileinto "INBOX.Notifications.DMARC";
stop;
}
# Rule Notifications - customer support [glob patterns]
if
anyof (
header :regex "From" "(^|,)[[:space:]]*\"?.*customer.*.?\\(are\\|uccess\\|upport\\)\"?[[:space:]]*<",
header :regex "Subject" "(?i)(\\b(feedback|opinion).*review)|(\\breview.*(experience|order|purchase))|(\\b(leave|write)\\b.*review)|(\\bshare|love (your|some) (thoughts|feedback|experience))"
)
{
fileinto "INBOX.Notifications";
stop;
}
# Rule Notifications [regular expressions]
if
anyof(
header :regex "Subject" "\\b((?i:Privacy|User).*((?i:Policy|Agreement).*$)|(?i:Protect|Register|Update).*((?i:Your Account).*$))",
header :regex "Subject" "\\b((?i:Important|Critical).*((?i:Account|Plan).*(?i:Information|Updates))|^.*(?i:Failed|Unsuccessful).*(?i:Deployment)(\\b.*?|$))",
header :regex "Subject" "^.*((?i:Google Account)).*((?i:Inactive|Closed|Settings))(\\b.*?|$)",
header :regex "Subject" "^.*((?i:Weekly|Monthly).*(?i:Report|Update))(\\b.*?|$)"
)
{
setflag "\\Seen";
fileinto "INBOX.Notifications";
stop;
}
# Rule Github [mailing list id]
if
header :regex "List-ID" ".*github\\.com"
{
fileinto "INBOX.Notifications.Github";
stop;
}
# Rule Social [from targeting]
# Search: "from:facebook.com OR from:twitter.com OR from:linkedin.com OR from:tumblr.com"
if
anyof(
address :contains "From" "twitter.com",
address :contains "From" "facebook.com",
address :contains "From" "linkedin.com",
address :contains "From" "tumblr.com"
)
{
fileinto "INBOX.Social";
stop;
}
# Rule Newsletters [list-unsubscribe]
if
exists "List-Unsubscribe"
{
fileinto "INBOX.Newsletters";
stop;
}