From c9441e070a42bbf4992fd80d640c7828e3b7b9e2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Jan 2013 17:20:28 -0500 Subject: symlink a bunch of things into .config --- .config/maildirproc/default.rc | 362 +++++++++++++++++++++++++++++++++++++++++ .config/maildirproc/purdue.rc | 84 ++++++++++ 2 files changed, 446 insertions(+) create mode 100644 .config/maildirproc/default.rc create mode 100644 .config/maildirproc/purdue.rc (limited to '.config/maildirproc') diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc new file mode 100644 index 0000000..ecea80f --- /dev/null +++ b/.config/maildirproc/default.rc @@ -0,0 +1,362 @@ +# -*- mode: python; -*- + +import subprocess + +processor.maildir_base = "~/Maildir" +processor.auto_reload_rcfile = True + +def is_to_or_from(mail,address): + """ + Return true if [mail] is to or from an address that contains [address]. + """ + return ( + False + or mail["From"].contains(address) + or mail["Reply-To"].contains(address) + or mail.target.contains(address)) +def is_to_or_from_re(mail,address): + """ + Return true if [mail] is to or from an address that matches the + regex [address]. + """ + return ( + mail["From"].matches(address) + or mail.target.matches(address)) + +def bogofilter_auto(mail): + p = subprocess.Popen( + ["bogofilter", "-u", "-v", "-I", mail.path], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + (output, _) = p.communicate() + processor.log("*** Bogofilter result: {0!r}".format(output.rstrip())) + if p.returncode not in [0, 1, 2]: + processor.log_error( + "Error running bogofilter: Return code = {0!r}".format( + p.returncode)) + return p.returncode + +def bogofilter_ham(mail): + subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) + +def bogofilter_spam(mail): + subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) + +def handle_incoming_spam_training(mail): + bogofilter_spam(mail) + mail.move(".Bulk Mail") + +def handle_incoming_ham_training(mail): + bogofilter_ham(mail) + handle_incoming_ham(mail) + +def handle_incoming_ham(mail): + my_filters(mail) +def handle_incoming_spam(mail): + mail.move(".Bulk Mail") + +def handle_incoming_unknown(mail): + # Filter spam + + spam = bogofilter_auto(mail) + if spam == 0: + handle_incoming_spam(mail) + return + elif spam == 1: + handle_incoming_ham(mail) + return + elif spam == 2: + # maybe spam + return + else: + mail.move(".Error") + return + +def my_filters(mail): + # Sort mail from GNU mailing lists + for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub', 'bug-gnuzilla' ]: + if ( + False + or mail["List-Id"].matches(list+"\.gnu\.org") + or mail["Subject"].contains(list) + ): + mail.move(".software."+list) + return + + # Sort mail from other software mailing lists + if ( + False + or mail["List-Id"].matches("social-discuss\.gnu\.org") + or mail["Subject"].contains("social-discuss") + ): + mail.move(".software.social") + return + + if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): + mail.move(".software.networkmanager") + return + + if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): + mail.move(".software.parabola-maintenance") + return + if ( + False + or mail["List-Id"].matches("parabolagnulinux.org") + or is_to_or_from(mail, "parabolagnulinux.org") + or is_to_or_from(mail, "kiwwwi.com.ar") + or is_to_or_from(mail, "parabola.nu") + ): + mail.move(".software.parabola-dev") + return + + if (mail["List-Id"].matches("pacman-dev.archlinux.org")): + mail.move(".software.pacman-dev") + return + + for subject_re in [ + "\[Stow-[^\]]*\].*", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".software") + return + + # Sort mail from some social websites + if mail["From"].matches("facebook(|mail)\.com"): + mail.move(".Social.Facebook") + return + + if ( + False + or mail["From"].matches("identi\.ca") + or mail["From"].matches("statusnet") + ): + mail.move(".Social.Identica") + return + + if mail["From"].matches("twitter\.com"): + mail.move(".Social.Twitter") + return + + if mail["From"].matches("@xkcd\.com"): + mail.move(".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 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") + ): + mail.move(".Troop276") + return + + # Sort mail from misc people + if mail["From"].matches("margieshu@sbcglobal\.net"): + mail.move(".misc.Mom") + return + + for address in [ + "justicejade10@aol.com", + "parsonsjade@aol.com", + "parsonstjade@gmail.com", + "jadparso@umail.iu.edu", + ]: + if mail["From"].contains(address): + mail.move(".misc.Jade") + return + + for address in [ + "nintendo.com", + "nintendo-news.com", + ]: + if mail["From"].contains(address): + mail.move(".misc.Nintendo") + return + + for address in [ + "@lpi.org", + "@pearson.com", + "CompTIA", + ]: + if mail["From"].contains(address): + mail.move(".misc.CompTIA") + return + + # Sort mail from FRC people + for address in [ + "@ni.com", + "@usfirst.org", + "BBonahoom@stanleyworks.com", + "allison.m.babcock@gmail.com", + "bryanbonahoom@gmail.com", + "cdewalt3@yahoo.com", + "dave.nelson@ecolab.com", + "dickaustin190@yahoo.com", + "djnels1@comcast.net", # Dave and Julie Nelson + "gamefreak207@gmail.com", # Brett Leedy + "jason.zielke@gmail.com", + "jeffreysmith@msdlt.k12.in.us", + "sarahlittell@comcast.net", + "silioso@gmail.com", + "skiplittell@comcast.net", + "tswilson4801@att.net", + "wcxctrack829@aim.com", # Pat + "william.walk@gmail.com", + ]: + if is_to_or_from(mail,address): + mail.move(".School.Robotics") + return + for subject_re in [ + "FIRST", + "robotics", + "1024", + "kil-?a-?bytes", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".School.Robotics") + return + + # Sort mail from software people + for address in [ + "gnu.org", + "gnome.org", + "eff.org", + "gitorious.org", + "sourceforge.com", + "ietf.org", + "kde.org", + "trustees@core3.amsl.com", + "esr@thyrsus.com", + "canonical.org", + "foocorp.net", + "cnuk.org", + "@archlinux.org", + "@github.com", + ]: + if is_to_or_from(mail,address): + mail.move(".software") + return + + + # Sort mail from the school newspaper + if ( + False + or is_to_or_from(mail, "@lnnorthstar.org") + or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") + ): + mail.move(".School.Newspaper") + return + + # Sort mail from various employers/people who pay me + if is_to_or_from(mail, "@precisepath.com"): + mail.move(".Work.PrecisePath") + return + + if is_to_or_from(mail,"susyphil@aol.com"): + mail.move(".Work.PMCH") + + for address in [ + "d.farrar@comcast.net", + "dfarrar@avacoustics.net", + "@vmware.com", + ]: + if is_to_or_from(mail,address): + mail.move(".Work.FAST") + 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["Subject"].contains("newsletter") + or mail["From"].contains("Info@mailing.jamendo.com") + or mail["From"].contains("info@demandprogress.org") + ): + mail.move(".misc.Newsletters") + return + + if ( + False + or mail["From"].contains("@msdlt.k12.in.us") + or mail["From"].contains("naviance.com") + 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") + or mail["Subject"].contains("National Technical Honor Society") + or mail["Subject"].contains("NHS") + or mail["Subject"].contains("National Honor Society") + ): + mail.move(".School") + return + + # from college stuff + if ( + False + or mail["Subject"].contains("NYLF") # National Youth Leadership Conference + or mail["Subject"].contains("NSHSS") + ): + mail.move(".College.Societies") + return + if ( + False + #or mail["From"].contains(".edu") + or mail["From"].contains("admissions@") + #or mail["From"].contains("college") + #or mail["From"].contains("university") + or mail["Subject"].contains("college") + # now we get to the BS + or mail["From"].contains("@dreamitdoitindiana.com") + or mail["From"].contains("@indianatechinfo.org") + ): + mail.move(".College") + return + + if mail["From"].contains("@projectwonderful.com"): + mail.move(".ProjectWonderful") + return + + if ( + False + or mail["From"].matches("@localhost") + or mail["From"].matches("@[^,>]*\.local") + or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") + or mail["To"].matches("luke@") + ): + mail.move(".LocalSystems") + return + if ( + False + or mail["Subject"].contains("password") + or mail["Subject"].contains("account") + ): + mail.move(".misc.accounts") + return + + mail.move(".Ham") + +handle_mapping = { + ".": handle_incoming_unknown, + ".spam-training": handle_incoming_spam_training, + ".ham-training": handle_incoming_ham_training, + #".Ham": handle_incoming_ham, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc new file mode 100644 index 0000000..9a759f5 --- /dev/null +++ b/.config/maildirproc/purdue.rc @@ -0,0 +1,84 @@ +# -*- mode: python; -*- + +import subprocess + +processor.maildir_base = "~/Maildir.purdue" +processor.auto_reload_rcfile = True + +def is_to_or_from(mail,address): + """ + Return true if [mail] is to or from an address that contains [address]. + """ + return ( + mail["From"].contains(address) + or mail.target.contains(address)) +def is_to_or_from_re(mail,address): + """ + Return true if [mail] is to or from an address that matches the + regex [address]. + """ + return ( + mail["From"].matches(address) + or mail.target.matches(address)) + +def piazza_topic(mail, topic): + return ( + is_to_or_from(mail, topic+" on Piazza") + or mail["Subject"].contains(topic+" on Piazza")) + +def my_filters(mail): + # Generic stuff ######################################################## + + if mail["Subject"].contains("[PASE]"): + mail.move("INBOX.PASE") + return + + if mail["Subject"].contains("[PLUG]"): + mail.move("INBOX.PLUG") + return + + if is_to_or_from(mail,"linkedin.com"): + mail.move("INBOX.LinkedIn") + return + + if ( + False + or mail["Subject"].contains("[CS Opportunity Update]") + or mail["Subject"].contains("[CS Majors]") + ): + mail.move("INBOX.CS") + return + + # Fall 2012 ############################################################ + + if mail["Subject"].contains("Fall-2012-SCI-21000-001:"): + mail.move("INBOX.classes.2012-2.SCI210") + if mail["Subject"].contains("fall-2012-cs-18000"): + mail.move("INBOX.classes.2012-2.CS180") + return + if piazza_topic(mail, "CS 18000"): + mail.move("INBOX.classes.2012-2.CS180.Piazza") + return + if mail["Subject"].contains("Fall-2012-SOC-10000"): + mail.move("INBOX.classes.2012-2.SOC100") + return + + # Spring 2013 ########################################################## + + if mail["Subject"].contains("[CS240]") or mail["Subject"].contains("Spring-2013-CS-24000"): + mail.move("INBOX.classes.2013-1.CS240") + return + if piazza_topic(mail, "CS 240"): + mail.move("INBOX.classes.2013-1.CS240.Piazza") + return + + if mail["Subject"].contains("Spring-2013-CS-18200"): + mail.move("INBOX.classes.2013-1.CS182") + return + +handle_mapping = { + "INBOX": my_filters, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) -- cgit v1.2.3-2-g168b From 153d31083211bad2f87cdc162f1b25218cb2879c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 8 Apr 2013 10:08:12 -0400 Subject: add more filters to my purdue mail filter --- .config/maildirproc/purdue.rc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 9a759f5..e5ed066 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -65,15 +65,20 @@ def my_filters(mail): # Spring 2013 ########################################################## + if mail["Subject"].contains("[CS240] Submission result for"): + mail.move("INBOX.classes.2013-1.CS240.autograder") + return if mail["Subject"].contains("[CS240]") or mail["Subject"].contains("Spring-2013-CS-24000"): mail.move("INBOX.classes.2013-1.CS240") return if piazza_topic(mail, "CS 240"): mail.move("INBOX.classes.2013-1.CS240.Piazza") return - - if mail["Subject"].contains("Spring-2013-CS-18200"): - mail.move("INBOX.classes.2013-1.CS182") + if mail["Subject"].matches(".*(PHYS|CHIP)\s*220.*") or is_to_or_from(mail,"srdas@purdue.edu"): + mail.move("INBOX.classes.2013-1.PHYS220") + return + if mail["Subject"].contains("Spring-2013-SOC-22000"): + mail.move("INBOX.classes.2013-1.SOC220") return handle_mapping = { -- cgit v1.2.3-2-g168b From 2a74875560f44afca9719c1615e34d782ff1a889 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 10:43:11 -0400 Subject: maildirproc/default.rc: be stricter about GNU mailing lists --- .config/maildirproc/default.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index ecea80f..c1b7ead 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -78,7 +78,7 @@ def my_filters(mail): if ( False or mail["List-Id"].matches(list+"\.gnu\.org") - or mail["Subject"].contains(list) + or mail["Subject"].contains('['+list+']') ): mail.move(".software."+list) return -- cgit v1.2.3-2-g168b From 49f1b4a161d1ccfa3f16ae4b6aaa954da52e12c2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 10:43:39 -0400 Subject: maildirproc/default.rc: have mail from parabola.nu go to a separate folder --- .config/maildirproc/default.rc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index c1b7ead..c4e8cdc 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -99,12 +99,17 @@ def my_filters(mail): if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): mail.move(".software.parabola-maintenance") return + + + if is_to_or_from(mail, "parabola.nu"): + mail.move(".software.parabola-labs") + return + if ( False or mail["List-Id"].matches("parabolagnulinux.org") or is_to_or_from(mail, "parabolagnulinux.org") or is_to_or_from(mail, "kiwwwi.com.ar") - or is_to_or_from(mail, "parabola.nu") ): mail.move(".software.parabola-dev") return -- cgit v1.2.3-2-g168b From 488b877689ba0965ea6ccb527f54d64ddef6479c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 10:45:27 -0400 Subject: maildirproc/default.rc: use is_to_or_from instead of contains for Jade --- .config/maildirproc/default.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index c4e8cdc..2941bd1 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -180,7 +180,7 @@ def my_filters(mail): "parsonstjade@gmail.com", "jadparso@umail.iu.edu", ]: - if mail["From"].contains(address): + if is_to_or_from(mail,address): mail.move(".misc.Jade") return -- cgit v1.2.3-2-g168b From ee6959e9363021f25e854153d24282f3ea1ab3d4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Aug 2013 10:46:05 -0400 Subject: maildirproc/purdue.rc: learn about a few more lists --- .config/maildirproc/purdue.rc | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index e5ed066..6a37bc3 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -33,14 +33,44 @@ def my_filters(mail): mail.move("INBOX.PASE") return - if mail["Subject"].contains("[PLUG]"): + if ( + False + or mail["Subject"].contains("[PLUG]") + or is_to_or_from(mail,"Purduealumni@purdue.edu") + or is_to_or_from(mail,"pase@purdue.edu") + ): mail.move("INBOX.PLUG") return + if mail["From"].matches(".*bursar.*@purdue\.edu"): + mail.move("INBOX.tuition") + return + + if mail["From"].contains("mailhub-admin@purdue.edu"): + mail.move("INBOX.mailhub-admin") + return + + if mail["From"].matches("pmx-.*@purdue.edu"): + mail.move("INBOX.spam") + return + if is_to_or_from(mail,"linkedin.com"): mail.move("INBOX.LinkedIn") return + if ( + False + or is_to_or_from(mail,"@edrtrust.com") + or is_to_or_from(mail,"@propertysolutions.com") + or is_to_or_from(mail,"collegestationapartments@gmail.com") + ): + mail.move("INBOX.CollegeStation") + return + + if mail["From"].matches("facebook(|mail)\.com"): + mail.move("INBOX.Facebook") + return + if ( False or mail["Subject"].contains("[CS Opportunity Update]") -- cgit v1.2.3-2-g168b From 5b768b6d87e212bab7c92bc94d0fb6f9c92ecb21 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 8 Sep 2013 12:28:11 -0400 Subject: maildirproc: use XDG --- .config/maildirproc/att.rc | 369 +++++++++++++++++++++++++++++++++++++++++ .config/maildirproc/default.rc | 367 ---------------------------------------- .config/maildirproc/purdue.rc | 2 + 3 files changed, 371 insertions(+), 367 deletions(-) create mode 100644 .config/maildirproc/att.rc delete mode 100644 .config/maildirproc/default.rc (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc new file mode 100644 index 0000000..2bfc002 --- /dev/null +++ b/.config/maildirproc/att.rc @@ -0,0 +1,369 @@ +# -*- mode: python; -*- + +import os +import subprocess + +processor.maildir_base = "~/Maildir" +processor.auto_reload_rcfile = True +processor.logfile = os.getenv('XDG_CACHE_HOME', "~/.cache")+"/maildirproc/att.log" + +def is_to_or_from(mail,address): + """ + Return true if [mail] is to or from an address that contains [address]. + """ + return ( + False + or mail["From"].contains(address) + or mail["Reply-To"].contains(address) + or mail.target.contains(address)) +def is_to_or_from_re(mail,address): + """ + Return true if [mail] is to or from an address that matches the + regex [address]. + """ + return ( + mail["From"].matches(address) + or mail.target.matches(address)) + +def bogofilter_auto(mail): + p = subprocess.Popen( + ["bogofilter", "-u", "-v", "-I", mail.path], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + (output, _) = p.communicate() + processor.log("*** Bogofilter result: {0!r}".format(output.rstrip())) + if p.returncode not in [0, 1, 2]: + processor.log_error( + "Error running bogofilter: Return code = {0!r}".format( + p.returncode)) + return p.returncode + +def bogofilter_ham(mail): + subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) + +def bogofilter_spam(mail): + subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) + +def handle_incoming_spam_training(mail): + bogofilter_spam(mail) + mail.move(".Bulk Mail") + +def handle_incoming_ham_training(mail): + bogofilter_ham(mail) + handle_incoming_ham(mail) + +def handle_incoming_ham(mail): + my_filters(mail) +def handle_incoming_spam(mail): + mail.move(".Bulk Mail") + +def handle_incoming_unknown(mail): + # Filter spam + + spam = bogofilter_auto(mail) + if spam == 0: + handle_incoming_spam(mail) + return + elif spam == 1: + handle_incoming_ham(mail) + return + elif spam == 2: + # maybe spam + return + else: + mail.move(".Error") + return + +def my_filters(mail): + # Sort mail from GNU mailing lists + for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub', 'bug-gnuzilla' ]: + if ( + False + or mail["List-Id"].matches(list+"\.gnu\.org") + or mail["Subject"].contains('['+list+']') + ): + mail.move(".software."+list) + return + + # Sort mail from other software mailing lists + if ( + False + or mail["List-Id"].matches("social-discuss\.gnu\.org") + or mail["Subject"].contains("social-discuss") + ): + mail.move(".software.social") + return + + if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): + mail.move(".software.networkmanager") + return + + if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): + mail.move(".software.parabola-maintenance") + return + + + if is_to_or_from(mail, "parabola.nu"): + mail.move(".software.parabola-labs") + return + + if ( + False + or mail["List-Id"].matches("parabolagnulinux.org") + or is_to_or_from(mail, "parabolagnulinux.org") + or is_to_or_from(mail, "kiwwwi.com.ar") + ): + mail.move(".software.parabola-dev") + return + + if (mail["List-Id"].matches("pacman-dev.archlinux.org")): + mail.move(".software.pacman-dev") + return + + for subject_re in [ + "\[Stow-[^\]]*\].*", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".software") + return + + # Sort mail from some social websites + if mail["From"].matches("facebook(|mail)\.com"): + mail.move(".Social.Facebook") + return + + if ( + False + or mail["From"].matches("identi\.ca") + or mail["From"].matches("statusnet") + ): + mail.move(".Social.Identica") + return + + if mail["From"].matches("twitter\.com"): + mail.move(".Social.Twitter") + return + + if mail["From"].matches("@xkcd\.com"): + mail.move(".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 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") + ): + mail.move(".Troop276") + return + + # Sort mail from misc people + if mail["From"].matches("margieshu@sbcglobal\.net"): + mail.move(".misc.Mom") + return + + for address in [ + "justicejade10@aol.com", + "parsonsjade@aol.com", + "parsonstjade@gmail.com", + "jadparso@umail.iu.edu", + ]: + if is_to_or_from(mail,address): + mail.move(".misc.Jade") + return + + for address in [ + "nintendo.com", + "nintendo-news.com", + ]: + if mail["From"].contains(address): + mail.move(".misc.Nintendo") + return + + for address in [ + "@lpi.org", + "@pearson.com", + "CompTIA", + ]: + if mail["From"].contains(address): + mail.move(".misc.CompTIA") + return + + # Sort mail from FRC people + for address in [ + "@ni.com", + "@usfirst.org", + "BBonahoom@stanleyworks.com", + "allison.m.babcock@gmail.com", + "bryanbonahoom@gmail.com", + "cdewalt3@yahoo.com", + "dave.nelson@ecolab.com", + "dickaustin190@yahoo.com", + "djnels1@comcast.net", # Dave and Julie Nelson + "gamefreak207@gmail.com", # Brett Leedy + "jason.zielke@gmail.com", + "jeffreysmith@msdlt.k12.in.us", + "sarahlittell@comcast.net", + "silioso@gmail.com", + "skiplittell@comcast.net", + "tswilson4801@att.net", + "wcxctrack829@aim.com", # Pat + "william.walk@gmail.com", + ]: + if is_to_or_from(mail,address): + mail.move(".School.Robotics") + return + for subject_re in [ + "FIRST", + "robotics", + "1024", + "kil-?a-?bytes", + ]: + if mail["Subject"].matches(subject_re): + mail.move(".School.Robotics") + return + + # Sort mail from software people + for address in [ + "gnu.org", + "gnome.org", + "eff.org", + "gitorious.org", + "sourceforge.com", + "ietf.org", + "kde.org", + "trustees@core3.amsl.com", + "esr@thyrsus.com", + "canonical.org", + "foocorp.net", + "cnuk.org", + "@archlinux.org", + "@github.com", + ]: + if is_to_or_from(mail,address): + mail.move(".software") + return + + + # Sort mail from the school newspaper + if ( + False + or is_to_or_from(mail, "@lnnorthstar.org") + or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") + ): + mail.move(".School.Newspaper") + return + + # Sort mail from various employers/people who pay me + if is_to_or_from(mail, "@precisepath.com"): + mail.move(".Work.PrecisePath") + return + + if is_to_or_from(mail,"susyphil@aol.com"): + mail.move(".Work.PMCH") + + for address in [ + "d.farrar@comcast.net", + "dfarrar@avacoustics.net", + "@vmware.com", + ]: + if is_to_or_from(mail,address): + mail.move(".Work.FAST") + 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["Subject"].contains("newsletter") + or mail["From"].contains("Info@mailing.jamendo.com") + or mail["From"].contains("info@demandprogress.org") + ): + mail.move(".misc.Newsletters") + return + + if ( + False + or mail["From"].contains("@msdlt.k12.in.us") + or mail["From"].contains("naviance.com") + 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") + or mail["Subject"].contains("National Technical Honor Society") + or mail["Subject"].contains("NHS") + or mail["Subject"].contains("National Honor Society") + ): + mail.move(".School") + return + + # from college stuff + if ( + False + or mail["Subject"].contains("NYLF") # National Youth Leadership Conference + or mail["Subject"].contains("NSHSS") + ): + mail.move(".College.Societies") + return + if ( + False + #or mail["From"].contains(".edu") + or mail["From"].contains("admissions@") + #or mail["From"].contains("college") + #or mail["From"].contains("university") + or mail["Subject"].contains("college") + # now we get to the BS + or mail["From"].contains("@dreamitdoitindiana.com") + or mail["From"].contains("@indianatechinfo.org") + ): + mail.move(".College") + return + + if mail["From"].contains("@projectwonderful.com"): + mail.move(".ProjectWonderful") + return + + if ( + False + or mail["From"].matches("@localhost") + or mail["From"].matches("@[^,>]*\.local") + or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") + or mail["To"].matches("luke@") + ): + mail.move(".LocalSystems") + return + if ( + False + or mail["Subject"].contains("password") + or mail["Subject"].contains("account") + ): + mail.move(".misc.accounts") + return + + mail.move(".Ham") + +handle_mapping = { + ".": handle_incoming_unknown, + ".spam-training": handle_incoming_spam_training, + ".ham-training": handle_incoming_ham_training, + #".Ham": handle_incoming_ham, + } +processor.maildirs = handle_mapping.keys() +for mail in processor: + handle_mapping[mail.maildir](mail) diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc deleted file mode 100644 index 2941bd1..0000000 --- a/.config/maildirproc/default.rc +++ /dev/null @@ -1,367 +0,0 @@ -# -*- mode: python; -*- - -import subprocess - -processor.maildir_base = "~/Maildir" -processor.auto_reload_rcfile = True - -def is_to_or_from(mail,address): - """ - Return true if [mail] is to or from an address that contains [address]. - """ - return ( - False - or mail["From"].contains(address) - or mail["Reply-To"].contains(address) - or mail.target.contains(address)) -def is_to_or_from_re(mail,address): - """ - Return true if [mail] is to or from an address that matches the - regex [address]. - """ - return ( - mail["From"].matches(address) - or mail.target.matches(address)) - -def bogofilter_auto(mail): - p = subprocess.Popen( - ["bogofilter", "-u", "-v", "-I", mail.path], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - (output, _) = p.communicate() - processor.log("*** Bogofilter result: {0!r}".format(output.rstrip())) - if p.returncode not in [0, 1, 2]: - processor.log_error( - "Error running bogofilter: Return code = {0!r}".format( - p.returncode)) - return p.returncode - -def bogofilter_ham(mail): - subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) - -def bogofilter_spam(mail): - subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) - -def handle_incoming_spam_training(mail): - bogofilter_spam(mail) - mail.move(".Bulk Mail") - -def handle_incoming_ham_training(mail): - bogofilter_ham(mail) - handle_incoming_ham(mail) - -def handle_incoming_ham(mail): - my_filters(mail) -def handle_incoming_spam(mail): - mail.move(".Bulk Mail") - -def handle_incoming_unknown(mail): - # Filter spam - - spam = bogofilter_auto(mail) - if spam == 0: - handle_incoming_spam(mail) - return - elif spam == 1: - handle_incoming_ham(mail) - return - elif spam == 2: - # maybe spam - return - else: - mail.move(".Error") - return - -def my_filters(mail): - # Sort mail from GNU mailing lists - for list in [ 'bug-gsrc', 'bug-make', 'help-make', 'social', 'help-grub', 'bug-gnuzilla' ]: - if ( - False - or mail["List-Id"].matches(list+"\.gnu\.org") - or mail["Subject"].contains('['+list+']') - ): - mail.move(".software."+list) - return - - # Sort mail from other software mailing lists - if ( - False - or mail["List-Id"].matches("social-discuss\.gnu\.org") - or mail["Subject"].contains("social-discuss") - ): - mail.move(".software.social") - return - - if mail["List-Id"].matches("networkmanager-list\.gnome\.org"): - mail.move(".software.networkmanager") - return - - if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): - mail.move(".software.parabola-maintenance") - return - - - if is_to_or_from(mail, "parabola.nu"): - mail.move(".software.parabola-labs") - return - - if ( - False - or mail["List-Id"].matches("parabolagnulinux.org") - or is_to_or_from(mail, "parabolagnulinux.org") - or is_to_or_from(mail, "kiwwwi.com.ar") - ): - mail.move(".software.parabola-dev") - return - - if (mail["List-Id"].matches("pacman-dev.archlinux.org")): - mail.move(".software.pacman-dev") - return - - for subject_re in [ - "\[Stow-[^\]]*\].*", - ]: - if mail["Subject"].matches(subject_re): - mail.move(".software") - return - - # Sort mail from some social websites - if mail["From"].matches("facebook(|mail)\.com"): - mail.move(".Social.Facebook") - return - - if ( - False - or mail["From"].matches("identi\.ca") - or mail["From"].matches("statusnet") - ): - mail.move(".Social.Identica") - return - - if mail["From"].matches("twitter\.com"): - mail.move(".Social.Twitter") - return - - if mail["From"].matches("@xkcd\.com"): - mail.move(".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 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") - ): - mail.move(".Troop276") - return - - # Sort mail from misc people - if mail["From"].matches("margieshu@sbcglobal\.net"): - mail.move(".misc.Mom") - return - - for address in [ - "justicejade10@aol.com", - "parsonsjade@aol.com", - "parsonstjade@gmail.com", - "jadparso@umail.iu.edu", - ]: - if is_to_or_from(mail,address): - mail.move(".misc.Jade") - return - - for address in [ - "nintendo.com", - "nintendo-news.com", - ]: - if mail["From"].contains(address): - mail.move(".misc.Nintendo") - return - - for address in [ - "@lpi.org", - "@pearson.com", - "CompTIA", - ]: - if mail["From"].contains(address): - mail.move(".misc.CompTIA") - return - - # Sort mail from FRC people - for address in [ - "@ni.com", - "@usfirst.org", - "BBonahoom@stanleyworks.com", - "allison.m.babcock@gmail.com", - "bryanbonahoom@gmail.com", - "cdewalt3@yahoo.com", - "dave.nelson@ecolab.com", - "dickaustin190@yahoo.com", - "djnels1@comcast.net", # Dave and Julie Nelson - "gamefreak207@gmail.com", # Brett Leedy - "jason.zielke@gmail.com", - "jeffreysmith@msdlt.k12.in.us", - "sarahlittell@comcast.net", - "silioso@gmail.com", - "skiplittell@comcast.net", - "tswilson4801@att.net", - "wcxctrack829@aim.com", # Pat - "william.walk@gmail.com", - ]: - if is_to_or_from(mail,address): - mail.move(".School.Robotics") - return - for subject_re in [ - "FIRST", - "robotics", - "1024", - "kil-?a-?bytes", - ]: - if mail["Subject"].matches(subject_re): - mail.move(".School.Robotics") - return - - # Sort mail from software people - for address in [ - "gnu.org", - "gnome.org", - "eff.org", - "gitorious.org", - "sourceforge.com", - "ietf.org", - "kde.org", - "trustees@core3.amsl.com", - "esr@thyrsus.com", - "canonical.org", - "foocorp.net", - "cnuk.org", - "@archlinux.org", - "@github.com", - ]: - if is_to_or_from(mail,address): - mail.move(".software") - return - - - # Sort mail from the school newspaper - if ( - False - or is_to_or_from(mail, "@lnnorthstar.org") - or is_to_or_from(mail, "lnnorthstar.org@tigertech.net") - ): - mail.move(".School.Newspaper") - return - - # Sort mail from various employers/people who pay me - if is_to_or_from(mail, "@precisepath.com"): - mail.move(".Work.PrecisePath") - return - - if is_to_or_from(mail,"susyphil@aol.com"): - mail.move(".Work.PMCH") - - for address in [ - "d.farrar@comcast.net", - "dfarrar@avacoustics.net", - "@vmware.com", - ]: - if is_to_or_from(mail,address): - mail.move(".Work.FAST") - 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["Subject"].contains("newsletter") - or mail["From"].contains("Info@mailing.jamendo.com") - or mail["From"].contains("info@demandprogress.org") - ): - mail.move(".misc.Newsletters") - return - - if ( - False - or mail["From"].contains("@msdlt.k12.in.us") - or mail["From"].contains("naviance.com") - 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") - or mail["Subject"].contains("National Technical Honor Society") - or mail["Subject"].contains("NHS") - or mail["Subject"].contains("National Honor Society") - ): - mail.move(".School") - return - - # from college stuff - if ( - False - or mail["Subject"].contains("NYLF") # National Youth Leadership Conference - or mail["Subject"].contains("NSHSS") - ): - mail.move(".College.Societies") - return - if ( - False - #or mail["From"].contains(".edu") - or mail["From"].contains("admissions@") - #or mail["From"].contains("college") - #or mail["From"].contains("university") - or mail["Subject"].contains("college") - # now we get to the BS - or mail["From"].contains("@dreamitdoitindiana.com") - or mail["From"].contains("@indianatechinfo.org") - ): - mail.move(".College") - return - - if mail["From"].contains("@projectwonderful.com"): - mail.move(".ProjectWonderful") - return - - if ( - False - or mail["From"].matches("@localhost") - or mail["From"].matches("@[^,>]*\.local") - or mail["From"].matches("@[^,>]*\.lukeshu\.ath\.cx") - or mail["To"].matches("luke@") - ): - mail.move(".LocalSystems") - return - if ( - False - or mail["Subject"].contains("password") - or mail["Subject"].contains("account") - ): - mail.move(".misc.accounts") - return - - mail.move(".Ham") - -handle_mapping = { - ".": handle_incoming_unknown, - ".spam-training": handle_incoming_spam_training, - ".ham-training": handle_incoming_ham_training, - #".Ham": handle_incoming_ham, - } -processor.maildirs = handle_mapping.keys() -for mail in processor: - handle_mapping[mail.maildir](mail) diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 6a37bc3..4277a54 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -1,9 +1,11 @@ # -*- mode: python; -*- +import os import subprocess processor.maildir_base = "~/Maildir.purdue" processor.auto_reload_rcfile = True +processor.logfile = os.getenv('XDG_CACHE_HOME', "~/.cache")+"/maildirproc/purdue.log" def is_to_or_from(mail,address): """ -- cgit v1.2.3-2-g168b From 9c7d45f8a27600d0e8d1b6521bbaee7a4c0e451b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 8 Sep 2013 12:31:52 -0400 Subject: maildirproc: add my Fall 2013 classes, fix the PASE and PLUG rules --- .config/maildirproc/purdue.rc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 4277a54..0199c30 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -31,16 +31,16 @@ def piazza_topic(mail, topic): def my_filters(mail): # Generic stuff ######################################################## - if mail["Subject"].contains("[PASE]"): - mail.move("INBOX.PASE") - return - if ( - False - or mail["Subject"].contains("[PLUG]") + False + or mail["Subject"].contains("[PASE]") or is_to_or_from(mail,"Purduealumni@purdue.edu") or is_to_or_from(mail,"pase@purdue.edu") ): + mail.move("INBOX.PASE") + return + + if mail["Subject"].contains("[PLUG]"): mail.move("INBOX.PLUG") return @@ -113,6 +113,18 @@ def my_filters(mail): mail.move("INBOX.classes.2013-1.SOC220") return + # Fall 2013 ############################################################ + + if piazza_topic(mail, "CS 250") piazza_topic(mail,"CS 250-FALL2013") or mail["Subject"].contains("Fall-2013-CS-25000"): + mail.move("INBOX.classes.2013-2.CS250") + return + if piazza_topic(mail, "CS 251") or mail["Subject"].contains("Fall-2013-CS-25100"): + mail.move("INBOX.classes.2013-2.CS251") + return + if mail["Subject"].contains("Fall-2013-SPAN-10100"): + mail.move("INBOX.classes.2013-2.CS251") + return + handle_mapping = { "INBOX": my_filters, } -- cgit v1.2.3-2-g168b From 8302a0fd388ec5decb2900780d52fd696f03f189 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Sep 2013 13:53:15 -0400 Subject: maildirproc: fix indents --- .config/maildirproc/att.rc | 2 +- .config/maildirproc/purdue.rc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index 2bfc002..ac70c8a 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -1,4 +1,4 @@ -# -*- mode: python; -*- +# -*- mode: python; indent-tabs-mode: t -*- import os import subprocess diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 0199c30..45c031d 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -1,4 +1,4 @@ -# -*- mode: python; -*- +# -*- mode: python; indent-tabs-mode: t -*- import os import subprocess @@ -32,8 +32,8 @@ def my_filters(mail): # Generic stuff ######################################################## if ( - False - or mail["Subject"].contains("[PASE]") + False + or mail["Subject"].contains("[PASE]") or is_to_or_from(mail,"Purduealumni@purdue.edu") or is_to_or_from(mail,"pase@purdue.edu") ): -- cgit v1.2.3-2-g168b From 1bf624b56726501adffdfa3a0b703784521bbfcf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Sep 2013 13:53:37 -0400 Subject: maildirproc/purdue.rc: add rules --- .config/maildirproc/purdue.rc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index 45c031d..e075576 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -73,6 +73,10 @@ def my_filters(mail): mail.move("INBOX.Facebook") return + if is_to_or_from(mail,"@cable.comcast.com"): + mail.move("INBOX.Comcast") + return + if ( False or mail["Subject"].contains("[CS Opportunity Update]") @@ -115,14 +119,20 @@ def my_filters(mail): # Fall 2013 ############################################################ - if piazza_topic(mail, "CS 250") piazza_topic(mail,"CS 250-FALL2013") or mail["Subject"].contains("Fall-2013-CS-25000"): + if mail["Subject"].contains("Fall-2013-CS-25000"): mail.move("INBOX.classes.2013-2.CS250") return - if piazza_topic(mail, "CS 251") or mail["Subject"].contains("Fall-2013-CS-25100"): + if piazza_topic(mail, "CS 250") or piazza_topic(mail, "CS 250-FALL2013"): + mail.move("INBOX.classes.2013-2.CS250.Piazza") + return + if mail["Subject"].contains("Fall-2013-CS-25100"): mail.move("INBOX.classes.2013-2.CS251") return + if piazza_topic(mail, "CS 251"): + mail.move("INBOX.classes.2013-2.CS251.Piazza") + return if mail["Subject"].contains("Fall-2013-SPAN-10100"): - mail.move("INBOX.classes.2013-2.CS251") + mail.move("INBOX.classes.2013-2.SPAN101") return handle_mapping = { -- cgit v1.2.3-2-g168b From e1043019f159b0b3302fa5c933c9a84b4cfb50ad Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 12 Oct 2013 14:30:12 -0400 Subject: add mail filters --- .config/maildirproc/att.rc | 15 +++++++++++++-- .config/maildirproc/purdue.rc | 12 +++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to '.config/maildirproc') diff --git a/.config/maildirproc/att.rc b/.config/maildirproc/att.rc index ac70c8a..e862b3f 100644 --- a/.config/maildirproc/att.rc +++ b/.config/maildirproc/att.rc @@ -99,10 +99,22 @@ def my_filters(mail): return if mail["List-Id"].matches("maintenance.lists.parabolagnulinux.org"): + if mail["From"].contains("monit@"): + if mail["Message-Id"].contains("@repo.parabolagnulinux.org"): + mail.move(".software.parabola-maintenance.monit-repo") + return + if mail["Message-Id"].contains("@rshg054.dnsready.net"): + mail.move(".software.parabola-maintenance.monit-rshg054") + return + if mail["Subject"].matches("Cron <.*@repo>"): + mail.move(".software.parabola-maintenance.cron-repo") + return + if mail["Subject"].matches("Cron <.*@rshg054>"): + mail.move(".software.parabola-maintenance.cron-rshg054") + return mail.move(".software.parabola-maintenance") return - if is_to_or_from(mail, "parabola.nu"): mail.move(".software.parabola-labs") return @@ -228,7 +240,6 @@ def my_filters(mail): mail.move(".School.Robotics") return for subject_re in [ - "FIRST", "robotics", "1024", "kil-?a-?bytes", diff --git a/.config/maildirproc/purdue.rc b/.config/maildirproc/purdue.rc index e075576..0ffc1e6 100644 --- a/.config/maildirproc/purdue.rc +++ b/.config/maildirproc/purdue.rc @@ -73,7 +73,11 @@ def my_filters(mail): mail.move("INBOX.Facebook") return - if is_to_or_from(mail,"@cable.comcast.com"): + if ( + False + or is_to_or_from(mail,"@cable.comcast.com") + or is_to_or_from(mail,"@apexsystemsinc.com") + ): mail.move("INBOX.Comcast") return @@ -134,6 +138,12 @@ def my_filters(mail): if mail["Subject"].contains("Fall-2013-SPAN-10100"): mail.move("INBOX.classes.2013-2.SPAN101") return + if mail["Subject"].contains("Fall-2013-MA-26100"): + mail.move("INBOX.classes.2013-2.MA261") + return + if mail["Subject"].contains("Fall-2013-MA-26500"): + mail.move("INBOX.classes.2013-2.MA265") + return handle_mapping = { "INBOX": my_filters, -- cgit v1.2.3-2-g168b