-
Notifications
You must be signed in to change notification settings - Fork 2
/
filters.rb
472 lines (429 loc) · 10.3 KB
/
filters.rb
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
require 'gmail-britta'
fs = GmailBritta.filterset(:me => [
]) do
# Finance: Accounting
filter {
from '[email protected]'
label 'Finance/Accounting'
}
# Finance: Bank
bank = filter {
has [
{:or => [
'cba.com.au',
'commbank.com.au',
'commonwealthawards.com.au',
].map{|domain| "from:#{domain}"}},
]
label 'Finance/Bank'
}.archive_unless_directed
bank.also {
has [
'from:[email protected]',
{:or => [
'New account statement',
'New credit card statement',
].map{|subject| "subject:\"#{subject}\""}},
]
label 'Finance/Bank/Statements'
mark_important
star
}
bank.also {
has [
'from:[email protected]',
{:or => [
'"We were unable to process one of your scheduled transfers."',
'"Your scheduled transfer was successfully processed."',
]},
'"From account:"',
'"To account:"',
'"Description:"',
'"Amount:"',
]
archive
label 'Finance/Bank/Transfers'
}.also {
has ['"Your scheduled transfer was successfully processed."']
mark_read
}
# Firearms: Dealers
filter {
has [
{:or => [
'brownells.com',
'cleaverfirearms.com',
'gunsngear.com.au',
'safarifirearms.com.au',
].map{|domain| "from:#{domain}"}},
]
label 'Firearms/Dealers'
}.archive_unless_directed.also {
label 'Firearms'
}
# Firearms: Political
filter {
has [
{:or => [
'sfp.org.au',
].map{|email| "from:#{email}"}},
]
label 'Firearms'
}.archive_unless_directed
# Firearms: Registry
filter {
has [
{:or => [
].map{|email| "from:#{email}"}},
]
label 'Firearms/Registry'
}.also {
label 'Firearms'
}
# Gumtree
filter {
from '[email protected]'
subject 'new results for your saved search'
archive
label 'Newsletters'
mark_unimportant
}
# Invoices
# TODO: Improve this filter
filter {
has [
{:or => [
{:or => [
'Billing Statement',
'Payment Receipt',
'Tax Invoice',
'Receipt for Purchase',
'Order Receipt',
].map{|subject| "subject:\"#{subject}\""}},
{:or => [
'Tax Invoice',
].map{|text| "\"#{text}\""}},
# Blacklisted senders
{:or => [
# eBay
[
'from:[email protected]',
'subject:"eBay Invoice Notification"',
],
[
'from:[email protected]',
'subject:"Your invoice for eBay purchases"',
],
# PayPal
[
'from:[email protected]',
'subject:"Receipt for your payment"',
],
# Roam
[
'from:[email protected]',
'subject:"Your Roam Statement is available online"',
],
# Telstra
[
'from:online.telstra.com',
'subject:"Telstra bill for account"',
'has:attachment',
],
[
'from:[email protected]',
'subject:"Your Opal card quarterly activity statement"',
'has:attachment',
],
[
'from:amazon.com',
'subject:"Amazon Web Services Billing Statement Available"',
]
]},
]},
]
label 'Invoices'
mark_important
star
}
# Newsletters
filter {
has [
{:or => [
{:or => [
'"Add to address book"',
'"Add us to your address book"',
]},
{:or => [
'"Forward this email to a friend"',
'"Forward to a friend"',
]},
{:or => [
'"You are receiving this email because you subscribed"',
'"You have subscribed"',
'"You received this email because you signed up"',
]},
{:or => [
'"Email not displaying correctly?"',
'"To view this email as a web page"',
'"View this online"',
]},
{:or => [
'"This email was automatically sent"',
]},
{:or => [
'"We hope you enjoyed receiving this message"',
'"We want to stay in touch, but only if you want us to"',
]},
].combination(2).to_a},
{:or => [
'"Click here to unsubscribe"',
'"If you do not want to receive e-mails"',
'"If you no longer want us to contact you"',
'"If you wish to not receive any other emails from us"',
'"Manage your email settings or unsubscribe"',
'"Rather not receive future emails"',
'"Remove me from this list"',
'"Remove yourself from this list"',
'"To disable this communication"',
'"To stop receiving emails"',
'"Unsubscribe from this list"',
'"Update subscription preferences"',
'"You can also unsubscribe by writing to"',
'"You can unsubscribe here"',
]},
]
archive
label 'Newsletters'
mark_unimportant
}
filter {
from [{or: [
]}]
archive
label 'Newsletters'
mark_unimportant
}
# Newsletters (blacklist)
filter {
has [
{:or => [
].map{|email| "from:#{email}"}},
]
archive
label 'Newsletters'
mark_unimportant
}
# Orders
# TODO: Improve this filter.
filter {
has [
{:or => [
{:or => [
'Confirmation number',
'Order confirmation',
'Order details',
'Order has shipped',
'Shipping confirmation',
'Tracking number',
].map{|text| "\"#{text}\""}},
# Blacklisted senders
{:or => [
].map{|email| "from:#{email}"}},
]},
]
label 'Orders'
}
# Phone: Telstra
filter {
from 'telstra.com'
label 'Phone'
}.archive_unless_directed
# Pregnancy / Baby Newsletters
filter {
from '[email protected]'
archive
label 'Newsletters'
}.also {
label 'Pregnancy'
}
# Projects: GitHub
github = filter {
from '[email protected]'
label 'Projects'
}.archive_unless_directed
# Projects: Phabricator
phabricator = filter {
from '[email protected]'
label 'Projects'
}.archive_unless_directed
# Projects: Travis
travis = filter {
from '[email protected]'
label 'Projects'
}.archive_unless_directed
# Projects: arcanist
github.also {
has ['list:arcanist.phacility.github.com']
label 'Projects/arcanist'
}
phabricator.also {
has ['"REPOSITORY rARC Arcanist"']
label 'Projects/arcanist'
}
# Projects: libphutil
github.also {
has ['list:libphutil.phacility.github.com']
label 'Projects/libphutil'
}
phabricator.also {
has ['"REPOSITORY rPHU libphutil"']
label 'Projects/libphutil'
}
# Projects: Phabricator
github.also {
has ['list:phabricator.phacility.github.com']
label 'Projects/Phabricator'
}
phabricator.also {
has ['"REPOSITORY rP Phabricator"']
label 'Projects/Phabricator'
}
# Social: Calendar
filter {
has ['filename:invite.ics']
label 'Social/Calendar'
}.also {
label 'Social'
}.also {
subject 'Invitation'
star
}
# Social: Facebook
filter {
from 'facebookmail.com'
archive
label 'Social/Facebook'
}.also {
label 'Social'
smart_label 'social'
}
# Social: Google+
filter {
from 'plus.google.com'
archive
label 'Social/Google+'
}.also {
label 'Social'
smart_label 'social'
}
# Social: LinkedIn
filter {
from 'linkedin.com'
label 'Social/LinkedIn'
}.also {
has [
{:or => [
].map{|email| "from:#{email}"}},
]
archive
}.also {
label 'Social'
smart_label 'social'
}
# Social: Twitter
filter {
has [
{:or => [
'postmaster.twitter.com',
].map{|email| "from:#{email}"}},
]
archive
label 'Social/Twitter'
}.also {
label 'Social'
smart_label 'social'
}
# Travel
filter {
from 'tripadvisor.com'
label 'Travel'
}
# University
filter {
to '[email protected]'
label 'University'
}.archive_unless_directed
# Vehicle: Roam
filter {
has [
{:or => [
'roam.com.au',
].map{|email| "from:#{email}"}},
]
label 'Vehicle'
}
# Web: Amazon Web Services
filter {
has [
{:or => [
'amazon.com',
'amazonaws.com',
].map{|email| "from:#{email}"}},
]
label 'Web/Amazon Web Services'
}.also {
label 'Web'
}
# Web: Digital Pacific
filter {
from 'digitalpacific.com.au'
label 'Web/Digital Pacific'
}.also {
label 'Web'
}
end
puts fs.generate