From 12afcca02d88e47eaebce7e338b105ca1d56ac9c Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Wed, 6 Mar 2013 22:43:12 +1600 Subject: [PATCH] notspam: a notmuch interface to spamassassin --- ca/5374b6edc102dcefdf1250c36148c475d508d7 | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 ca/5374b6edc102dcefdf1250c36148c475d508d7 diff --git a/ca/5374b6edc102dcefdf1250c36148c475d508d7 b/ca/5374b6edc102dcefdf1250c36148c475d508d7 new file mode 100644 index 000000000..dcc52c09a --- /dev/null +++ b/ca/5374b6edc102dcefdf1250c36148c475d508d7 @@ -0,0 +1,130 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id C64E5431FBD + for ; Tue, 5 Mar 2013 22:43:37 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id mhhgBVPnpSRb for ; + Tue, 5 Mar 2013 22:43:18 -0800 (PST) +Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu + [131.215.239.19]) + by olra.theworths.org (Postfix) with ESMTP id 22F35431FAF + for ; Tue, 5 Mar 2013 22:43:18 -0800 (PST) +Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by fire-doxen-postvirus (Postfix) with ESMTP id A27E22E50C8D + for ; Tue, 5 Mar 2013 22:43:17 -0800 (PST) +X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new +Received: from finestructure.net (cpe-76-166-145-133.socal.res.rr.com + [76.166.145.133]) (Authenticated sender: jrollins) + by fire-doxen-submit (Postfix) with ESMTP id 791C62E507D2 + for ; Tue, 5 Mar 2013 22:43:15 -0800 (PST) +Received: by finestructure.net (Postfix, from userid 1000) + id E029362216; Tue, 5 Mar 2013 22:43:14 -0800 (PST) +From: Jameson Graef Rollins +To: Notmuch Mail +Subject: notspam: a notmuch interface to spamassassin +User-Agent: Notmuch/0.15+8~gd4a7374 (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-pc-linux-gnu) +Date: Tue, 05 Mar 2013 22:43:12 -0800 +Message-ID: <87sj49gha7.fsf@servo.finestructure.net> +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; + micalg=pgp-sha256; protocol="application/pgp-signature" +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 06 Mar 2013 06:43:40 -0000 + +--=-=-= +Content-Type: text/plain + +Hey, folks. I put together a little python program as an interface +between notmuch and spamassassin (sa) that I thought others might be +interested in: + +git://finestructure.net/notspam + +It's only dependencies are a running local sa daemon and python-notmuch. +It's pretty straightforward: it's just a single python script that has +two main functions 'learn' and 'tag'. 'Learn' takes a notmuch search +and pipes the resulting messages into sa (via sa-learn) to be classified +as ham or spam. 'Tag' takes a notmuch search and passes the resulting +messages through the sa classifier (via spamc) to be tagged as ham or +spam. + +Here's how I've been using it: + + * Tag spam manually with the tag 'spam'. It's good to have done this + for a while to build up a good amount of manual classification. + + * Once you've got some manual classification, teach sa: + + notspam learn spam tag:spam + notspam learn ham not tag:spam + + Everything after the meat ('spam'/'ham') are the notmuch search + terms. Rerun this periodically to update, but you might want to + restrict the search a little so sa-learn doesn't eat a lot of + overhead reprocessing old messages that haven't changed + classification. + + * Call 'notspam tag' in your post-new hook (all my new messages are + tagged 'new' initially): + + notspam tag --spam=spamd tag:new + + I give the sa-classified mail a different tag so it's easy to + distinguish what was classified by me and what was classified by sa. + +Pretty simple. See 'notspam help' for more info. + +Right now it's geared specifically for sa, but it would be easy to +expand it to handle arbitrary learn/classify commands. If there's any +further interest in this, I would be happy to help push on it more. + +jamie. + +PS: if anyone has any suggestions for Bayesian classifiers better than +sa I'm all ears. I'm not so happy with sa at the moment. It misses a +lot more spam than I would like. Maybe I just haven't tweaked it out +yet, in which case if anyone has any suggestions on how to improve sa's +classification I'm also all ears. + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iQIcBAEBCAAGBQJRNuWAAAoJEO00zqvie6q8OdwP/27j7evFUi1nU2YVmFIiPM2+ +S0AYVUd+WhWkTcHtaTw52G7iBI6nWwY2/01Itt35TToVhHpkbIu4LEcCdOIc+Lmx +xfZ9cNy6brXNqveMSmF69haiVsenMfbl606aZcrQjEoQyk7AClxqnKxorihJD/LP +uNt7aCZhi+hzRCCHq+Xeb8n4vPBHQ602KGhqaC8zJ1zgeGfFj9Zi5S0ZuMPkozJF +0JFHyXcnlcFGKInGZ0ShSYQmvg3VDNnYk8uHRGSUdtUdFZbXg9gtDm23Ppsj6kaM ++k8g2z3fUunF4K043tyJsbsCbQkRtnXv5k3BAGNytkxwpoqOb8W9uT/f8wmbRuni +hImYfkG6qvxKPVcnz2Xgz/6kVfca04tD+PlFlo311i3d2hocu751mRfzEDm+Ffwc +kGbyzUoFR0/Jc+Fon7C3I7h0kw/A9fjc5kJELGoeKW7v293nu7MppJ9iJResSXBG +l25f77Z3cWXUklL9I249Cf/WHcOO3MMf84XsUemiLrRag872rdzK1IHLc5aOmrwd +2tS0goxSPo6+2h1JW0KMTiOEmAv3oxW109bYC9EDeQOpQ2a0RoAlokGNFtr0p4Ac +dupPrUPS303ES3c5WmGyF88Yt8MfwhLY4Kx7oSgjxa7G4M8s1LSpSscnn8VtcXpp +QRodps2Eb25NQ6qGQlIi +=CXJB +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2