summaryrefslogtreecommitdiff
path: root/.config/maildirproc/att.rc
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-12-06 23:49:26 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-12-06 23:52:42 -0500
commit65bb0acde892d608fe2937ad194664b031df2c28 (patch)
tree53360926af428095cd228a1d30794d45f24b89b7 /.config/maildirproc/att.rc
parent3306324e032199c0af8c9ea1f0e29b102b806a59 (diff)
update mail filters
Diffstat (limited to '.config/maildirproc/att.rc')
-rw-r--r--.config/maildirproc/att.rc151
1 files changed, 103 insertions, 48 deletions
diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc
index 792b42c..397ffcf 100644
--- a/.config/maildirproc/att.rc
+++ b/.config/maildirproc/att.rc
@@ -23,6 +23,19 @@ def mailman_domain(mail, domain):
return m.group(1)
return None
+def ezmlm_domain(mail, domain):
+ """
+ Return a string that is the list-name for a ezmlm domain
+ """
+ m = mail["Mailing-List"].matches("^(.* )?(\w+)(-\S*)?@"+re.escape(domain)+"(;.*)?$")
+ if m:
+ return m.group(2)
+ for hdr in [ 'To', 'Cc', 'From' ]:
+ m = mail[hdr].matches("(\w)@"+re.escape(domain))
+ if m:
+ return m.group(1)
+ return None
+
def is_to_or_from(mail,address):
"""
Return true if [mail] is to or from an address that contains [address].
@@ -86,25 +99,38 @@ def handle_incoming_unknown(mail):
# Whitelist
if (
False
+ or is_to_or_from(mail, "Bryan@ChankTunUnGi.onmicrosoft.com")
+ or is_to_or_from(mail, "cacnedcomms@gmail.com")
or is_to_or_from(mail, "fsf.org")
or is_to_or_from(mail, "gnu.org")
or is_to_or_from(mail, "parabola.nu")
or is_to_or_from(mail, "parabolagnulinux.org")
- or mail["From"] == "MAILER-DAEMON@yahoo.com"
or mail["From"] == "3174451635@mms.att.net"
+ or mail["From"] == "MAILER-DAEMON@yahoo.com"
+ or mail["From"].contains("@e.oldnational.com>")
or mail["From"].contains("@facebookmail.com>")
or mail["From"].contains("@gandi.net")
or mail["From"].contains("@github.com>")
or mail["From"].contains("@goodwillindy.org>")
or mail["From"].contains("@kickstarter.com>")
+ or mail["From"].contains("@list.cr.yp.to")
or mail["From"].contains("@lpi.org>")
+ or mail["From"].contains("@lulzbot.com>")
+ or mail["From"].contains("@mail.scribd.com>")
+ or mail["From"].contains("@massdrop.com>")
or mail["From"].contains("@msdlt.k12.in.us>")
or mail["From"].contains("@parabola.nu")
or mail["From"].contains("@post.oreilly.com>")
or mail["From"].contains("@scouting.org>")
+ or mail["From"].contains("@solutionsinplastic.com>")
+ or mail["From"].contains("@startcom.org>")
+ or mail["From"].contains("@usfirst.org>")
or mail["From"].contains("@wolframalpha.com>")
+ or mail["From"].contains("Promo@email.newegg.com")
+ or mail["From"].contains("info@email2.mysimplemobile.com")
or mail["From"].contains("margieshu@sbcglobal.net")
or mail["From"].contains("parabolagnulinux.org")
+ or mail["From"].matches("@[a-z]+\.gandi\.net")
or mail["List-Id"].matches(".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org")
or mail["List-Id"].matches(".*\.parabola\.nu")
or mail["Subject"].contains("[Dev]")
@@ -144,7 +170,12 @@ def my_filters(mail):
[ 'parabola.nu', 'parabola' ] ]:
list = mailman_domain(mail, pair[0])
if list:
- move_ham(mail,".software."+pair[1]+"."+list)
+ move_ham(mail, ".software."+pair[1]+"."+list)
+ return
+ for pair in [ [ 'list.cr.yp.to', 'djb' ] ]:
+ list = ezmlm_domain(mail, pair[0])
+ if list:
+ move_ham(mail, ".software."+pair[1]+"."+list)
return
if (
False
@@ -152,12 +183,12 @@ def my_filters(mail):
or is_to_or_from(mail, "parabola.nu")
or is_to_or_from(mail, "kiwwwi.com.ar")
):
- move_ham(mail,".software.parabola")
+ move_ham(mail, ".software.parabola")
return
# Sort mail from some social websites
if mail["From"].matches("facebook(|mail)\.com"):
- move_ham(mail,".Social.Facebook")
+ move_ham(mail, ".Social.Facebook")
return
if (
@@ -165,7 +196,7 @@ def my_filters(mail):
or mail["From"].matches("identi\.ca")
or mail["From"].matches("statusnet")
):
- move_ham(mail,".Social.Identica")
+ move_ham(mail, ".Social.Identica")
return
if (
@@ -173,49 +204,54 @@ def my_filters(mail):
or mail["From"].contains("@gandi.net")
or mail["From"].contains("@ramhost.us")
or mail["From"].contains("@startcom.org")
+ or (mail["From"].contains("@2co.com") and mail["Subject"].contains("RAM Host"))
):
- move_ham(mail,".lukeshu-com")
+ move_ham(mail, ".lukeshu-com")
return
if mail["From"].matches("twitter\.com"):
- move_ham(mail,".Social.Twitter")
+ move_ham(mail, ".Social.Twitter")
return
if mail["From"].matches("@xkcd\.com"):
- move_ham(mail,".Social.xkcd")
+ move_ham(mail, ".Social.xkcd")
return
# Sort mail related to Troop 276
if (
False
or mail["List-Id"].contains("troopmailinglist.troop276.net")
- or is_to_or_from(mail,"t276_announcements@att.net")
+ or is_to_or_from(mail, "t276_announcements@att.net")
or mail["Subject"].matches("troop")
or mail["Subject"].matches("merit\s*badge")
- or is_to_or_from(mail,"jsting@sbcglobal.net")
- or is_to_or_from(mail,"trdindy@comcast.net")
- or is_to_or_from(mail,"wjensen111@aol.com")
- or is_to_or_from(mail,"dhoyt@yourhomecompany.com")
- or is_to_or_from(mail,"salupo_vincent_p@lilly.com")
- or is_to_or_from(mail,"basu@maharjan.org")
- or is_to_or_from(mail,"muellerindy@yahoo.com")
- or is_to_or_from(mail,"solorzano.luis@rocketmail.com")
- or is_to_or_from(mail,"eldredmac@comcast.net")# MacDonell
- or is_to_or_from(mail,"mitchprather@sbcglobal.net")
- or is_to_or_from(mail,"oa_wap@yahoo.com")
- or is_to_or_from(mail,"mytroop.us")
- or is_to_or_from(mail,"crossroadsbsa.org")
+ or is_to_or_from(mail, "Bryan@ChankTunUnGi.onmicrosoft.com")
+ or is_to_or_from(mail, "basu@maharjan.org")
+ or is_to_or_from(mail, "cacnedcomms@gmail.com")
+ or is_to_or_from(mail, "crossroadsbsa.org")
+ or is_to_or_from(mail, "dhoyt@yourhomecompany.com")
+ or is_to_or_from(mail, "dllargent@comcast.net")
+ or is_to_or_from(mail, "eldredmac@comcast.net")# MacDonell
+ or is_to_or_from(mail, "jsting@sbcglobal.net")
+ or is_to_or_from(mail, "mitchprather@sbcglobal.net")
+ or is_to_or_from(mail, "muellerindy@yahoo.com")
+ or is_to_or_from(mail, "mytroop.us")
+ or is_to_or_from(mail, "oa_wap@yahoo.com")
+ or is_to_or_from(mail, "salupo_vincent_p@lilly.com")
+ or is_to_or_from(mail, "scouting.org")
+ or is_to_or_from(mail, "solorzano.luis@rocketmail.com")
+ or is_to_or_from(mail, "trdindy@comcast.net")
+ or is_to_or_from(mail, "wjensen111@aol.com")
):
- move_ham(mail,".BoyScouts")
+ move_ham(mail, ".BoyScouts")
return
# Sort mail from misc people
if (
False
- or is_to_or_from(mail,"margieshu@sbcglobal.net")
- or is_to_or_from(mail,"3174451635@mms.att.net")
+ or is_to_or_from(mail, "margieshu@sbcglobal.net")
+ or is_to_or_from(mail, "3174451635@mms.att.net")
):
- move_ham(mail,".misc.Mom")
+ move_ham(mail, ".misc.Mom")
return
for address in [
@@ -223,23 +259,24 @@ def my_filters(mail):
"nintendo-news.com",
]:
if mail["From"].contains(address):
- move_ham(mail,".misc.Nintendo")
+ move_ham(mail, ".misc.Nintendo")
return
for address in [
"@lpi.org",
"@pearson.com",
+ "ciscotraining-notify@cisco.com",
"CompTIA",
]:
if mail["From"].contains(address):
- move_ham(mail,".misc.CompTIA")
+ move_ham(mail, ".misc.CompTIA")
return
# Sort mail from FRC people
# Generic
for address in [ "@ni.com", "@usfirst.org" ]:
if is_to_or_from(mail,address):
- move_ham(mail,".FRC")
+ move_ham(mail, ".FRC")
return
# FRC 829
for address in [
@@ -247,10 +284,10 @@ def my_filters(mail):
"william.walk@gmail.com",
]:
if is_to_or_from(mail,address):
- move_ham(mail,".FRC.829")
+ move_ham(mail, ".FRC.829")
return
if mail["Subject"].matches("\b829\b"):
- move_hame(mail,".FRC.829")
+ move_ham(mail, ".FRC.829")
return
# FRC 1024
for address in [
@@ -270,15 +307,15 @@ def my_filters(mail):
"tswilson4801@att.net",
]:
if is_to_or_from(mail,address):
- move_ham(mail,".FRC.1024")
+ move_ham(mail, ".FRC.1024")
return
for subject_re in [ "\b1024\b", "kil-?a-?bytes" ]:
if mail["Subject"].matches(subject_re):
- move_ham(mail,".FRC.1024")
+ move_ham(mail, ".FRC.1024")
return
# FRC 4272
if mail["Subject"].matches("\b4272\b"):
- move_hame(mail,".FRC.4272")
+ move_ham(mail, ".FRC.4272")
return
# Catch BS things because of CS classes before the general
@@ -310,7 +347,7 @@ def my_filters(mail):
"@thyrsus.com",
]:
if is_to_or_from(mail,address):
- move_ham(mail,".software")
+ move_ham(mail, ".software")
return
# Sort mail from the school newspaper
@@ -319,21 +356,38 @@ def my_filters(mail):
or is_to_or_from(mail, "@lnnorthstar.org")
or is_to_or_from(mail, "lnnorthstar.org@tigertech.net")
):
- move_ham(mail,".HighSchool.Newspaper")
+ move_ham(mail, ".HighSchool.Newspaper")
return
# Sort misc newsletters
if (
False
or mail["From"].contains("newsletter")
- or mail["From"].contains("auto@comicsbyemail.com")
- or mail["From"].contains("oreilly.com")
+ or mail["From"].contains("announcements")
or mail["Subject"].contains("newsletter")
+ or mail["Message-Id"].contains("@sailthru.com")
+ or False
+ or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net"))
+ or (mail["From"].contains("no-reply@kickstarter.com") and mail["Message-Id"].contains(".sendgrid.net"))
+ or (mail["From"].contains("no-reply@kickstarter.com") and (
+ False
+ or mail["Subject"].contains("Projects We Love:")
+ or mail["Subject"].contains("Project Update")))
or mail["From"].contains("Info@mailing.jamendo.com")
+ or mail["From"].contains("Promo@email.newegg.com")
+ or mail["From"].contains("auto@comicsbyemail.com")
or mail["From"].contains("info@demandprogress.org")
- or (mail["From"].contains("@sparkfun.com") and mail["Message-Id"].contains("rsgsv.net"))
+ or mail["From"].contains("info@email2.mysimplemobile.com")
+ or mail["From"].contains("info@massdrop.com")
+ or mail["From"].contains("info@lulzbot.com")
+ or mail["From"].contains("oreilly.com")
+ or mail["From"].contains("reply-to@e.digikey.com")
+ or mail["From"].contains("communication@communications.bmv.in.gov")
+ or mail["From"].contains("sales@solutionsinplastic.com")
+ or mail["From"].contains("social@goodwillindy.org")
+ or mail["From"].contains("support@support.digitalocean.com")
):
- move_ham(mail,".misc.Newsletters")
+ move_ham(mail, ".misc.Newsletters")
return
if (
@@ -341,7 +395,7 @@ def my_filters(mail):
or mail["From"].contains("@msdlt.k12.in.us")
or mail["From"].contains("ltschoolfoundation@gmail.com")
or mail["From"].contains("naviance.com")
- or is_to_or_from(mail,"ibwhite@comcast.net")
+ or is_to_or_from(mail, "ibwhite@comcast.net")
or mail["Subject"].contains("IOA")
or mail["From"].contains("nths.org")
or mail["Subject"].contains("NTHS")
@@ -349,7 +403,7 @@ def my_filters(mail):
or mail["Subject"].contains("NHS")
or mail["Subject"].contains("National Honor Society")
):
- move_ham(mail,".HighSchool")
+ move_ham(mail, ".HighSchool")
return
# from college stuff
@@ -358,7 +412,7 @@ def my_filters(mail):
or mail["Subject"].contains("NYLF") # National Youth Leadership Conference
or mail["Subject"].contains("NSHSS")
):
- move_ham(mail,".College.Societies")
+ move_ham(mail, ".College.Societies")
return
if (
False
@@ -368,11 +422,11 @@ def my_filters(mail):
or mail["From"].contains("@dreamitdoitindiana.com")
or mail["From"].contains("@indianatechinfo.org")
):
- move_ham(mail,".College")
+ move_ham(mail, ".College")
return
if mail["From"].contains("@projectwonderful.com"):
- move_ham(mail,".misc.ProjectWonderful")
+ move_ham(mail, ".misc.ProjectWonderful")
return
if (
@@ -382,17 +436,18 @@ def my_filters(mail):
or mail["From"].matches("@[^,>]*\.lan")
or mail["To"].matches("luke@")
):
- move_ham(mail,".LocalSystems")
+ move_ham(mail, ".LocalSystems")
return
if (
False
or mail["Subject"].contains("password")
or mail["Subject"].contains("account")
+ or mail["From"].contains("accounts")
):
- move_ham(mail,".misc.accounts")
+ move_ham(mail, ".misc.accounts")
return
- move_ham(mail,"")
+ move_ham(mail, "")
handle_mapping = {
"Inbox": handle_incoming_unknown,