diff options
Diffstat (limited to '.config/maildirproc/default.rc')
-rw-r--r-- | .config/maildirproc/default.rc | 491 |
1 files changed, 456 insertions, 35 deletions
diff --git a/.config/maildirproc/default.rc b/.config/maildirproc/default.rc index 2b6e3c8..7dc3c0e 100644 --- a/.config/maildirproc/default.rc +++ b/.config/maildirproc/default.rc @@ -7,7 +7,8 @@ import subprocess import datetime import re import email.utils -# + +# # Mail attribute utilities def parse_address(x): @@ -95,6 +96,15 @@ def majordomo_domain(mail, domain): return m.group(1) return None +def github_domain(mail): + """ + Return a string that is the list-name for a GitHub domain + """ + m = match_re(parse_address(mail["List-Id"]), "(.*)\."+re.escape("github.com")) + if m: + return ".".join(reversed(m.group(1).split("."))) + return None + def is_from(mail, address): return any(match_glob(addr, address) for addr in originator_addresses(mail)) def is_from_re(mail, address): @@ -115,7 +125,7 @@ def is_me(address): def is_to_me(mail): return any(is_me(addr) for addr in destination_addresses(mail)) -# +# # bogofilter utilites def bogofilter_auto(mail): @@ -134,12 +144,11 @@ def bogofilter_ham(mail): subprocess.call(["bogofilter", "-S", "-n", "-I", mail.path]) def bogofilter_spam(mail): subprocess.call(["bogofilter", "-N", "-s", "-I", mail.path]) -# + +# # The core of my filters -def move_ham(mail, folder): - y = datetime.datetime.now().year - folder = "MAIN/Ham."+str(y)+folder +def ensure_folder(folder): dir = processor.maildir_base+"/"+folder if not os.path.isfile(dir+"/maildirfolder"): os.makedirs(dir+"/tmp", 0o777, True) @@ -147,64 +156,303 @@ def move_ham(mail, folder): os.makedirs(dir+"/cur", 0o777, True) open(dir+"/maildirfolder", 'a').close() subprocess.call(['make', '-C', os.environ['XDG_CONFIG_HOME']]) + +def move_ham(mail, folder): + now = datetime.datetime.now() + # now = email.utils.parsedate_to_datetime('%s' % mail["Date"]) + big_folders = [ + ".software.nongnu.qemu-devel", + ".software.kernel.git", + ".software.gnu.emacs-devel", + ".software.sourceware.libc-alpha", + ] + if folder in big_folders: + folder += ".%02d" % now.month + folder = "MAIN/Ham."+str(now.year)+folder + ensure_folder(folder) + mail.move(folder) + +def move_other(mail, typ): + now = datetime.datetime.now() + folder = "MAIN/"+typ+"."+str(now.year) + ensure_folder(folder) mail.move(folder) def my_whitelist(mail): return ( False - or is_to_or_from(mail, "opengroup.org") - or is_to_or_from(mail, "reproducible-builds.org") - or is_to_or_from(mail, "purestorage.com") - or is_to_or_from(mail, "sourceware.org") - or is_to_or_from(mail, "vger.kernel.org") + + # Specific people or is_to_or_from(mail, "Bryan@ChankTunUnGi.onmicrosoft.com") + or is_to_or_from(mail, "bill-auger@peers.community") or is_to_or_from(mail, "cacnedcomms@gmail.com") + or is_from(mail, "3174451635@mms.att.net") + or is_from(mail, "AnimalRescueoftheRockies@mailman.bloomerang-mail.com") + or is_from(mail, "Firecrafter38@wildapricot.org") + or is_from(mail, "MAILER-DAEMON@yahoo.com") + or is_from(mail, "Promo@email.newegg.com") + or is_from(mail, "flynn@kodachi.com") + or is_from(mail, "info@email2.mysimplemobile.com") + or is_from(mail, "luke.t.shumaker@gmail.com") + or is_from(mail, "margieshu@gmail.com") + or is_from(mail, "margieshu@sbcglobal.net") + or is_from(mail, "no-reply@sns.amazonaws.com") + or is_from(mail, "TrackingUpdates@fedex.com") + or is_to_or_from(mail, "shupetech.com") + or is_from(mail, "gunbarrelod@gmail.com") # Gunbarrel Optometry + or is_from(mail, "oral-b@reorder.com") + + # Software wildcard domains or is_to_or_from(mail, "fsf.org") or is_to_or_from(mail, "gnu.org") or is_to_or_from(mail, "nongnu.org") + or is_to_or_from(mail, "opengroup.org") or is_to_or_from(mail, "parabola.nu") or is_to_or_from(mail, "parabolagnulinux.org") - or is_from(mail, "schwab.com") - or is_from(mail, "redhat.com") - or is_from(mail, "linkedin.com") - or is_from(mail, "guru.com") - or is_from(mail, "3174451635@mms.att.net") - or is_from(mail, "MAILER-DAEMON@yahoo.com") + or is_to_or_from(mail, "puri.sm") + or is_to_or_from(mail, "reproducible-builds.org") + or is_to_or_from(mail, "sfconservancy.org") + or is_to_or_from(mail, "sourceware.org") + or is_to_or_from(mail, "sr.ht") + or is_to_or_from(mail, "vger.kernel.org") + or is_from(mail, "datawire.io") + or is_from(mail, "debian.org") + or is_from(mail, "google.com") + or is_from(mail, "keyboard.io") + or is_from(mail, "pine64.com") + + # Living situation domains + # Colorado + or is_from(mail, "meadowcreekapartments@emailrelay.com") + or is_from(mail, "@aircommunities.com") + or is_from(mail, "@kingsleyassociates.com") + or is_from(mail, "@luxerone.com") + or is_from(mail, "@mail.welcomehome.com") + or is_from(mail, "@myaimcohome.com") + or is_from(mail, "@myaircommunitieshome.com") + or is_from(mail, "aimco.com") + or is_from(mail, "alerts.comcast.net") + or is_from(mail, "boulder.noshdelivery.co") + or is_from(mail, "colorado.gov") + or is_from(mail, "conservicemail.com") + or is_from(mail, "emails.xfinity.com") + or is_from(mail, "entrata.com") + or is_from(mail, "govdelivery.com") + or is_from(mail, "realpage.com") + or is_from(mail, "residentportal.com") + or is_from(mail, "state.co.us") + or is_from(mail, "bch.org") + or is_from(mail, "mailer@messages.lhmailer.com") # Thomas Bogan DDS + or is_from(mail, "bouldercountyvotes.org") + + # Massachusetts + or is_from(mail, "eversource.com") + or is_from(mail, "getgreenmountainenergy.com") + or is_from(mail, "greenmountain.com") + or is_from(mail, "kelleyryan.com") + or is_from(mail, "mbta.com") + or is_from(mail, "nationalgrid.com") + or is_from(mail, "nationalgridus.com") + or is_from(mail, "rcn.com") + or is_from(mail, "rcn.net") + or is_from(mail, "state.ma.us") + # Indiana + or is_from(mail, "vectren.com") + or is_from(mail, "vectrenemail.com") + + # Other wildcard domains + or is_from(mail, "academia-mail.com") # academia.edu + or is_from(mail, "accounts.google.com") + or is_from(mail, "alibaba.com") + or is_from(mail, "amazon.com") + or is_from(mail, "amctheatres.com") + or is_from(mail, "att-mail.com") + or is_from(mail, "backerkit.com") + or is_from(mail, "bricklink.com") + or is_from(mail, "butcherbox.com") or is_from(mail, "careereco.com") + or is_from(mail, "carta.com") + or is_from(mail, "chewy.com") + or is_from(mail, "chiefdelphi.com") or is_from(mail, "ciholas.com") - or is_from(mail, "e.oldnational.com") + or is_from(mail, "circleci.com") + or is_from(mail, "discoursemail.com") + or is_from(mail, "docker.com") + or is_from(mail, "docusign.net") + or is_from(mail, "dominos.com") + or is_from(mail, "e.healthequity.com") + or is_from(mail, "ebay.com") + or is_from(mail, "emailbcbsma.com") + or is_from(mail, "eorderstart.com") + or is_from(mail, "etsy.com") + or is_from(mail, "eyemed.com") or is_from(mail, "facebookmail.com") + or is_from(mail, "firefox.com") + or is_from(mail, "flyfrontier.com") or is_from(mail, "gandi.net") + or is_from(mail, "gencon.com") or is_from(mail, "github.com") + or is_from(mail, "globeasphalt.net") or is_from(mail, "goodwillindy.org") + or is_from(mail, "groupmemailer.com") + or is_from(mail, "grubhub.com") + or is_from(mail, "guru.com") + or is_from(mail, "hellofresh.com") + or is_from(mail, "hulumail.com") + or is_from(mail, "intuit.com") or is_from(mail, "kickstarter.com") + or is_from(mail, "lego.com") + or is_from(mail, "linkedin.com") or is_from(mail, "list.cr.yp.to") or is_from(mail, "lpi.org") or is_from(mail, "lulzbot.com") + or is_from(mail, "lyftmail.com") + or is_from(mail, "mail.disneyplus.com") + or is_from(mail, "mail.plus.espn.com") or is_from(mail, "mail.scribd.com") + or is_from(mail, "maildl.att-mail.com") or is_from(mail, "massdrop.com") or is_from(mail, "msdlt.k12.in.us") + or is_from(mail, "naviabenefits.com") + or is_from(mail, "netflix.com") + or is_from(mail, "netlify.com") + or is_from(mail, "newegg.com") + or is_from(mail, "nintendo.com") + or is_from(mail, "oldnational.com") + or is_from(mail, "oralb.com") + or is_from(mail, "orderstart.com") + or is_from(mail, "ordertrack.wireless.att-mail.com") + or is_from(mail, "oreillyauto.com") + or is_from(mail, "patreon.com") + or is_from(mail, "paypal.com") + or is_from(mail, "peacocktv.com") + or is_from(mail, "plugable.com") or is_from(mail, "post.oreilly.com") + or is_from(mail, "proxyvote.com") + or is_from(mail, "publishingconcepts.com") # National Eagle Scout Association thing + or is_from(mail, "qobuz.com") + or is_from(mail, "raphnet-tech.com") + or is_from(mail, "raphnet.com") + or is_from(mail, "raphnet.net") + or is_from(mail, "redditmail.com") + or is_from(mail, "redhat.com") + or is_from(mail, "rockauto.com") + or is_from(mail, "scaleway.com") + or is_from(mail, "scaleway.net") + or is_from(mail, "schwab.com") or is_from(mail, "scouting.org") + or is_from(mail, "seeed.cc") + or is_from(mail, "slack.com") or is_from(mail, "solutionsinplastic.com") or is_from(mail, "startcom.org") + or is_from(mail, "steampowered.com") + or is_from(mail, "target.com") + or is_from(mail, "travelers.com") + or is_from(mail, "uhc.com") # united health care + or is_from(mail, "ultramobile.com") + or is_from(mail, "united.com") # airlines + or is_from(mail, "unitedhealthcare.com") + or is_from(mail, "upwork.com") or is_from(mail, "usfirst.org") - or is_from(mail, "vectren.com") - or is_from(mail, "vectrenemail.com") + or is_from(mail, "wikimedia.org") or is_from(mail, "wolframalpha.com") - or is_from(mail, "Promo@email.newegg.com") - or is_from(mail, "info@email2.mysimplemobile.com") - or is_from(mail, "margieshu@sbcglobal.net") - or is_from(mail, "parabolagnulinux.org") - or is_from(mail, "gandi.net") + or match_re(parse_address(mail["List-Id"]), ".*\.(gnu|gnome|archlinux|parabolagnulinuxlibre|fedorahosted)\.org") or match_re(parse_address(mail["List-Id"]), ".*\.parabola\.nu") + or match_re(parse_address(mail["List-Id"]), ".*\.lists\.arthurdejong\.org") or mail["Subject"].contains("[Dev]") or mail["Subject"].contains("[Maintenance]") or mail["Subject"].contains("[PATCH") or mail["Subject"].contains("[systemd-devel]") ) +def my_blacklist(mail): + return ( + False + or ((mail['Subject'] == "Предложение") and (email.utils.parseaddr(str(mail['From']))[0] == "Aleksandr")) + or ((mail['Subject'] == "Сотрудничество") and (email.utils.parseaddr(str(mail['From']))[0] == "Александр Николаевич")) + or ((mail['Subject'] == "Сотрудничество") and (email.utils.parseaddr(str(mail['From']))[0] == "Alex")) + or ((mail['Subject'] == "Ответьте на предложение (Respond to the offer)") and (email.utils.parseaddr(str(mail['From']))[0] == "Alex")) + or ((mail['Subject'] == "Offer (Предложение)") and (email.utils.parseaddr(str(mail['From']))[0] == "Aleksandr")) + # 126.com + or is_from(mail, "adalul@126.com") + or is_from(mail, "dangshiganggu614@126.com") + or is_from(mail, "dhutvnjj5566@126.com") + or is_from(mail, "jiushiyao554321@126.com") + or is_from(mail, "junlong16515@126.com") + or is_from(mail, "keqijiaozhuo2891@126.com") + or is_from(mail, "lisawu1985@126.com") + or is_from(mail, "massagegun@126.com") + or is_from(mail, "rondtang@126.com") + or is_from(mail, "sefunm1@126.com") + or is_from(mail, "smile202999@126.com") + or is_from(mail, "taoji22157902@126.com") + # 163.com + or is_from(mail, "13277914293@163.com") + or is_from(mail, "allycrystal@163.com") + or is_from(mail, "andycbd@163.com") + or is_from(mail, "anpingboliwiremesh@163.com") + or is_from(mail, "bouncesportswear@163.com") + or is_from(mail, "chinaagent2015@163.com") + or is_from(mail, "gavinsolar11@163.com") + or is_from(mail, "handsomeartsdec@163.com") + or is_from(mail, "hsly_toby@163.com") + or is_from(mail, "huixinrj01@163.com") + or is_from(mail, "jerry_truck@163.com") + or is_from(mail, "jessicaw8708@163.com") + or is_from(mail, "liangtongluo@163.com") + or is_from(mail, "megliuextract@163.com") + or is_from(mail, "mincsx@163.com") + or is_from(mail, "nbdef1@163.com") + or is_from(mail, "newhopeglassmirror@163.com") + or is_from(mail, "sally121386@163.com") + or is_from(mail, "sdfghjklxczc@163.com") + or is_from(mail, "smile6677888@163.com") + or is_from(mail, "steelbottle@163.com") + or is_from(mail, "sunonwirecloth2021@163.com") + or is_from(mail, "windyzhong2013@163.com") + or is_from(mail, "xingdui369@163.com") + or is_from(mail, "zmevergreen@163.com") + # gmail.com + or is_from(mail, "affasonrabi@gmail.com") + or is_from(mail, "bellawilliams9060@gmail.com") + or is_from(mail, "carlsen.monika@gmail.com") + or is_from(mail, "chiboy062@gmail.com") + or is_from(mail, "dinamckenna1894@gmail.com") + or is_from(mail, "edmondpamela60@gmail.com") + or is_from(mail, "evelynrichards10@gmail.com") + or is_from(mail, "farisethill630@gmail.com") + or is_from(mail, "h.vandrad@gmail.com") + or is_from(mail, "hanksrugo@gmail.com") + or is_from(mail, "harrykuunda@gmail.com") + or is_from(mail, "henrygunter835@gmail.com") + or is_from(mail, "ibrahimidewu4@gmail.com") + or is_from(mail, "jessicadaniel7833@gmail.com") + or is_from(mail, "jimmymoore265@gmail.com") + or is_from(mail, "laviis7111@gmail.com") + or is_from(mail, "lishalu25@gmail.com") + or is_from(mail, "lw23675851@gmail.com") + or is_from(mail, "mamadele79@gmail.com") + or is_from(mail, "mimihassan971@gmail.com") + or is_from(mail, "mrs.doris.david02@gmail.com") + or is_from(mail, "odemartha01@gmail.com") + or is_from(mail, "roseamedin02@gmail.com") + or is_from(mail, "sdltdkggl3455@gmail.com") + or is_from(mail, "sgtkalamanthey@gmail.com") + or is_from(mail, "sgtkaylama@gmail.com") + or is_from(mail, "sgtkaylamanthey612@gmail.com") + or is_from(mail, "weboutloock4@gmail.com") + # other + or is_from(mail, "info@frejgon.ru") + or is_from(mail, "sale3@victoriapcb.com") + or is_from(mail, "bcbssettlement.com") + or is_from(mail, "factor75.com") + or is_from(mail, "hannahjohnson8856@gmail.com") + or is_from(mail, "web@equiposhosteleria.com") + or (email.utils.parseaddr(str(mail['From']))[0] == "Louis Vuitton") + or (email.utils.parseaddr(str(mail['From']))[0] == "BOOM OF SALES") + ) + def my_filters(mail): if mail["From"].contains("Parabola Website Notification <nobody@parabola.nu>"): move_ham(mail, ".software.parabola.dev.web-notif") @@ -220,7 +468,8 @@ def my_filters(mail): return # .software.* (GNU Mailman) for pair in [ - [ 'archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! + [ 'lists.archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! (new: https://archlinux.org/news/arch-linux-mailing-list-id-changes/) + [ 'archlinux.org' , 'archlinux' ], # @sbcglobal.net and @lukeshu.com ; problems delivering to Yahoo! (old: https://archlinux.org/news/arch-linux-mailing-list-id-changes/) [ 'gnome.org' , 'gnome' ], # https://mail.gnome.org/mailman/options/networkmanager-list/lukeshu@lukeshu.com [ 'gnu.org' , 'gnu' ], # https://lists.gnu.org/mailman/options/bug-librejs/lukeshu@lukeshu.com [ 'listas.trisquel.info' , 'trisquel' ], @@ -257,6 +506,14 @@ def my_filters(mail): if list: move_ham(mail, ".software."+pair[1]+"."+list) return + # .software.GitHub + if is_to_or_from(mail, "github.com"): + list = github_domain(mail) + if list: + move_ham(mail, ".software.GitHub."+list) + return + move_ham(mail, ".software.GitHub") + return # .software.parabola if ( False @@ -279,13 +536,18 @@ def my_filters(mail): move_ham(mail, ".software.parabola") return # .software.TravisCI - if is_from(mail, "builds@travis-ci.org"): + if is_from(mail, "builds@travis-ci.org") or is_from(mail, "builds@travis-ci.com"): move_ham(mail, ".software.TravisCI") return + # .software.CircleCI + if is_from(mail, "builds@circleci.com"): + move_ham(mail, ".software.CircleCI") + return # .software for address in [ "archlinux.org", "canonical.org", + "circleci.com", "cnuk.org", "core3.amsl.com", "defectivebydesign.org", @@ -293,7 +555,6 @@ def my_filters(mail): "fedorahosted.org", "foocorp.net", "fsf.org", - "github.com", "gitorious.org", "gnome.org", "gnu.org", @@ -306,10 +567,15 @@ def my_filters(mail): "savoirfairelinux.com", "sourceforge.com", "thyrsus.com", + "travis-ci.com", + "travis-ci.org", ]: if is_to_or_from(mail, address): move_ham(mail, ".software") return + if mail["Subject"].contains("[PATCH"): + move_ham(mail, ".software") + return # .servers if ( False @@ -323,9 +589,99 @@ def my_filters(mail): or is_from(mail, "local") or is_from(mail, "lan") or is_from(mail, "lukeshu.com") + or is_from(mail, "sns.amazonaws.com") + or is_from(mail, "no-reply-aws@amazon.com") + or is_from(mail, "rsync.net") ): move_ham(mail, ".servers") return + # .MeadowCreek + if ( + False + or is_from(mail, "meadowcreekapartments@emailrelay.com") + or is_from(mail, "@aircommunities.com") + or is_from(mail, "@kingsleyassociates.com") + or is_from(mail, "@mail.welcomehome.com") + or is_from(mail, "@myaimcohome.com") + or is_from(mail, "@myaircommunitieshome.com") + or is_from(mail, "aimco.com") + or is_from(mail, "conservicemail.com") + or is_from(mail, "entrata.com") + or is_from(mail, "realpage.com") + or is_from(mail, "residentportal.com") + ): + move_ham(mail, ".MeadowCreek") + return + # .MeadowCreek.LuxerOne + if is_from(mail, "@luxerone.com"): + move_ham(mail, ".MeadowCreek.LuxerOne") + return + # .bills + if ( + False + or is_from(mail, "eversource.com") + or is_from(mail, "getgreenmountainenergy.com") + or is_from(mail, "greenmountain.com") + or is_from(mail, "kelleyryan.com") + or is_from(mail, "mbta.com") + or is_from(mail, "nationalgrid.com") + or is_from(mail, "nationalgridus.com") + or is_from(mail, "oldnational.com") + or is_from(mail, "rcn.com") + or is_from(mail, "rcn.net") + or is_from(mail, "tello.com") + or is_from(mail, "travelers.com") + or is_from(mail, "ultramobile.com") + ): + move_ham(mail, ".bills") + return + if is_from(mail, "alerts.comcast.net"): + move_ham(mail, ".bills.xfinity") + return + if is_from(mail, "emails.xfinity.com"): + move_ham(mail, ".bills.xfinity.probable-spam") + return + # .shopping + if ( + False + # special + or (is_from(mail, "messages@email.oreillyauto.com") and mail["Subject"].contains("rder")) + or (is_from(mail, "no-reply@lyftmail.com") and mail["Subject"].contains("Your ride")) + or (is_from(mail, "no-reply@dmsguild.com") and mail["Subject"].contains("Thank you for your Dungeon Masters Guild order")) + or (is_from(mail, "foresee.com") and email.utils.parseaddr(str(mail['From']))[0] == "OReillyAuto.com") + # @ + or is_from(mail, "auto-confirm@amazon.com") + or is_from(mail, "order-update@amazon.com") + or is_from(mail, "payments-messages@amazon.com") + or is_from(mail, "shipment-tracking@amazon.com") + or is_from(mail, "atoz-guarantee-no-reply@amazon.com") + or is_from(mail, "sales@covertinstruments.com") + or is_from(mail, "googlestore-noreply@google.com") + or is_from(mail, "shop@raphnet.com") + or is_from(mail, "orders@eat.grubhub.com") + # no @ + or is_from(mail, "boulder.noshdelivery.co") + or is_from(mail, "dominos.com") + or is_from(mail, "electroware.pl") + or is_from(mail, "eorderstart.com") # Rusty Melon + or is_from(mail, "etsy.com") + or is_from(mail, "inhouseorders.io") # Yurihana + or is_from(mail, "order.homedepot.com") + or is_from(mail, "orderstart.com") # Rusty Melon + or is_from(mail, "pine64.com") + or is_from(mail, "rockauto.com") # Snarf's + or is_from(mail, "rrtusa.com") # Snarf's + or is_from(mail, "stripe.com") # Yurihana + or is_from(mail, "swathestore.com") + ): + move_ham(mail, ".shopping") + return + if is_from(mail, "butcherbox.com"): + move_ham(mail, ".shopping.ButcherBox") + return + if is_from(mail, "hellofresh.com"): + move_ham(mail, ".shopping.HelloFresh") + return # .Social.* if is_from_re(mail, ".*[@.]facebook(|mail)\.com"): move_ham(mail, ".Social.Facebook") @@ -342,6 +698,18 @@ def my_filters(mail): if is_from(mail, "linkedin.com"): move_ham(mail, ".Social.LinkedIn") return + if is_from(mail, "redditmail.com"): + move_ham(mail, ".Social.Reddit") + return + if is_from(mail, "discord.com"): + move_ham(mail, ".Social.Discord") + return + if is_from(mail, "bingo@patreon.com"): + move_ham(mail, ".Social.Patreon") + return + if is_from(mail, "githubcommunity@discoursemail.com"): + move_ham(mail, ".Social.GitHubForum") + return # .jobs.* if is_from(mail, "guru.com"): move_ham(mail, ".jobs.Guru") @@ -349,6 +717,15 @@ def my_filters(mail): if is_from(mail, "glassdoor.com"): move_ham(mail, ".jobs.Glassdoor") return + if is_from(mail, "bountysource.com"): + move_ham(mail, ".jobs.Bountysource") + return + if is_from(mail, "upwork.com"): + move_ham(mail, ".jobs.Upwork") + return + if is_from(mail, "datawire.io"): + move_ham(mail, ".jobs.Datawire") + return # .BSA if ( False @@ -479,13 +856,27 @@ def my_filters(mail): if is_from(mail, "paypal.com"): move_ham(mail, ".misc.paypal") return + if is_from(mail, "intuit.com"): + move_ham(mail, ".misc.Intuit") + return + if is_from(mail, "qobuz.com"): + move_ham(mail, ".misc.Qobuz") + return if ( False or is_to_or_from(mail, "margieshu@sbcglobal.net") + or is_to_or_from(mail, "margieshu@gmail.com") or is_to_or_from(mail, "3174451635@mms.att.net") ): move_ham(mail, ".misc.Mom") return + if ( + False + or is_from(mail, "carta.com") + or is_from(mail, "proxyvote.com") + ): + move_ham(mail, ".misc.stocks") + return if is_to_or_from(mail, "freelancer.com"): move_ham(mail, ".misc.Freelancer") return @@ -512,6 +903,7 @@ def my_filters(mail): 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("Promo@promo.newegg.com") or mail["From"].contains("auto@comicsbyemail.com") or mail["From"].contains("info@demandprogress.org") or mail["From"].contains("info@email2.mysimplemobile.com") @@ -524,19 +916,38 @@ def my_filters(mail): or mail["From"].contains("social@goodwillindy.org") or mail["From"].contains("support@support.digitalocean.com") or mail["From"].contains("@pardonsnowden.org") + or mail["List-Id"].contains("sparkpostmail.com") + or mail["List-Id"].contains("mcsv.net") + or is_from(mail, "AnimalRescueoftheRockies@mailman.bloomerang-mail.com") + or is_from(mail, "support@vetsfirstchoice.com") + or is_from(mail, "customersupport@eatajs.com") + or is_from(mail, "boulder@noshdelivery.co") + or is_from(mail, "disneyplus@mail.disneyplus.com") + or is_from(mail, "fanservices@mail.plus.espn.com") + or is_from(mail, "ORewards@e3.oreillyauto.com") + or is_from(mail, "store-news@amazon.com") ): move_ham(mail, ".misc.Newsletters") return if ( False + or (is_from(mail, "no-reply@patreon.com") and mail["Subject"].contains("Patreon log in attempt")) + or (is_from(mail, "noreply@lyftmail.com") and mail["Subject"].contains("New Login")) + or (is_from(mail, "service@notice.alibaba.com") and mail["Subject"].contains("Verification Code")) + or (is_from(mail, "service@notice.alibaba.com") and mail["Subject"].contains("Verification Code")) or mail["Subject"].contains("password") or mail["Subject"].contains("account") or mail["From"].contains("accounts") + or is_from(mail, "account-update@amazon.com") ): move_ham(mail, ".misc.accounts") return + if is_from(mail, "alibaba.com"): + move_ham(mail, ".shopping.alibaba") + return move_ham(mail, "") + # # call the above @@ -545,18 +956,25 @@ def handle_incoming_ham_training(mail): handle_incoming_ham(mail) def handle_incoming_spam_training(mail): bogofilter_spam(mail) - mail.move("MAIN/Spam") + handle_incoming_spam(mail) def handle_incoming_ham(mail): my_filters(mail) def handle_incoming_spam(mail): - mail.move("MAIN/Spam") + if my_blacklist(mail): + move_other(mail, "SpammySpam") + else: + move_other(mail, "Spam") def handle_incoming_unknown(mail): # Whitelist if my_whitelist(mail): handle_incoming_ham_training(mail) return + # Blacklist + if my_blacklist(mail): + handle_incoming_spam_training(mail) + return spam = bogofilter_auto(mail) if spam == 0: @@ -566,23 +984,26 @@ def handle_incoming_unknown(mail): handle_incoming_ham(mail) return elif spam == 2: - mail.move("MAIN/MysteryMeat") + move_other(mail, "MysteryMeat") return else: - mail.move("MAIN/BogoFail") + move_other(mail, "BogoFail") return # hook the above functions into the maildirproc processor processor.maildir_base = "~/Maildir" processor.auto_reload_rcfile = True handle_mapping = { -# "REMOTES/ATT/Inbox": handle_incoming_unknown, -# "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! + # "REMOTES/ATT/Inbox": handle_incoming_unknown, + # "REMOTES/ATT/Bulk Mail": handle_incoming_unknown, # fucking Yahoo! "REMOTES/lukeshu/INBOX": handle_incoming_unknown, "QUEUES/Unknown": handle_incoming_unknown, "QUEUES/Spam": handle_incoming_spam_training, + "QUEUES/SpamNoTrain": handle_incoming_spam, "QUEUES/Ham": handle_incoming_ham_training, - } +} +for folder in handle_mapping: + ensure_folder(folder) processor.maildirs = handle_mapping.keys() for mail in processor: handle_mapping[mail.maildir](mail) |