]> git.cworth.org Git - notmuch-wiki/blob - initial_tagging.mdwn
cleanup initial tagging page
[notmuch-wiki] / initial_tagging.mdwn
1 # Approaches to initial tagging of messages
2
3 This page collects scripts and strategies for organizing mail using
4 notmuch and doing automated initial tagging.
5
6 Here's a very general and ad-hoc approach to initial message tagging.
7 The `[new]` config section allows you to control which tags new messages
8 receive.  This sets all new messages to get the *new* tag:
9
10     [new]
11     tags=new;
12
13 After running `notmuch new`, all new messages will be marked *new*.
14 You can then do various tag post-processing by just acting on messages
15 with that tag.  For instance, a post-processing script might do the
16 following:
17
18     # immediately archive all messages from "me"
19     notmuch tag -new -- tag:new and from:me@example.com
20
21     # delete all messages from a spammer:
22     notmuch tag +deleted -- tag:new and from:spam@spam.com
23
24     # tag all message from notmuch mailing list
25     notmuch tag +notmuch -- tag:new and to:notmuch@notmuchmail.org
26
27     # finally, retag all "new" messages "inbox" and "unread"
28     notmuch tag +inbox +unread -new -- tag:new
29
30 Since the post-processing is only acting on a few messages, it is
31 generally extremely fast.
32
33 You can use the `post-new` hook, which is automatically run after `notmuch new`,
34 to do post-processing. See `man notmuch-hooks` for details on hooks.
35
36
37 # Other solutions
38
39 * [Carl Worth's approach to tagging](http://notmuchmail.org/pipermail/notmuch/2010/001691.html). It
40   is email id:87r5o8stbj.fsf@yoom.home.cworth.org in the notmuch
41   mailing list archives.
42
43
44 * [One user's setup](http://notmuchmail.org/pipermail/notmuch/2010/001690.html)
45   (id:87hbp5j9dv.fsf@hackervisions.org), which includes using the
46   inbox tag as a "new mail" flag.
47
48 * [Another user's setup](http://notmuchmail.org/pipermail/notmuch/2011/003976.html)
49   (id:"87tyfu3k5a.fsf@gmail.com"), which uses a dedicated tag for
50   marking new mail, which is then sorted with a python script using
51   Bogofilter for spam detection.  This is generally a great deal
52   faster than a shell-scripted approach.  This approach introduces a
53   workflow built around a "watch" tag. Here, the user is only
54   presented with threads as they are started. At this point the user
55   can choose to watch the thread, in which case future messages will
56   be tagged with "inbox", or ignore it. This provides an excellent
57   means for dealing with a large flux of messages with a low
58   signal-to-noise.
59
60 * [afew](https://github.com/teythoon/afew) is an initial tagging
61   solution that should work out of the box for most basic tagging
62   needs (mailinglist handling, killed thread handling, autoarchiving
63   of sent mails) and has some fancy features (e.g. mail classification
64   using bayesian filters).
65
66 # Notmuch Delivery Agent -- `notmuch-deliver`
67
68 The [Notmuch Delivery Agent](http://github.com/alip/notmuch-deliver/)
69 ([announcement](http://notmuchmail.org/pipermail/notmuch/2010/002871.html)) is
70 a tool for delivering emails to maildir, add them to the Notmuch database, and
71 tag them as desired.