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