]> git.notmuchmail.org Git - notmuch/blob - notmuch.1
Make bodies locally toggleable
[notmuch] / notmuch.1
1 .\" notmuch - Not much of an email program, (just index, search and tagging)
2 .\"
3 .\" Copyright © 2009 Carl Worth
4 .\"
5 .\" Notmuch is free software: you can redistribute it and/or modify
6 .\" it under the terms of the GNU General Public License as published by
7 .\" the Free Software Foundation, either version 3 of the License, or
8 .\" (at your option) any later version.
9 .\"
10 .\" Notmuch is distributed in the hope that it will be useful,
11 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
12 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 .\" GNU General Public License for more details.
14 .\"
15 .\" You should have received a copy of the GNU General Public License
16 .\" along with this program.  If not, see http://www.gnu.org/licenses/ .
17 .\"
18 .\" Author: Carl Worth <cworth@cworth.org>
19 .TH NOTMUCH 1 2009-10-31 "Notmuch 0.1"
20 .SH NAME
21 notmuch \- thread-based email index, search, and tagging
22 .SH SYNOPSIS
23 .B notmuch
24 .IR command " [" args " ...]"
25 .SH DESCRIPTION
26 Notmuch is a command-line based program for indexing, searching,
27 reading, and tagging large collections of email messages.
28
29 The quickest way to get started with Notmuch is to simply invoke the
30 .B notmuch
31 command with no arguments, which will interactively guide you through
32 the process of indexing your mail.
33 .SH NOTE
34 While the command-line program
35 .B notmuch
36 provides powerful functionality, it does not provide the most
37 convenient interface for that functionality. More sophisticated
38 interfaces are expected to be built on top of either the command-line
39 interface, or more likely, on top of the notmuch library
40 interface. See http://notmuchmail.org for more about alternate
41 interfaces to notmuch.
42 .SH COMMANDS
43 The
44 .BR setup
45 command is used to configure Notmuch for first use, (or to reconfigure
46 it later).
47 .RS 4
48 .TP 4
49 .B setup
50
51 Interactively sets up notmuch for first use.
52
53 The setup command will prompt for your full name, your primary email
54 address, any alternate email addresses you use, and the directory
55 containing your email archives. Your answers will be written to a
56 configuration file in ${NOTMUCH_CONFIG} (if set) or
57 ${HOME}/.notmuch-config . This configuration file will be created with
58 descriptive comments, making it easy to edit by hand later to change the
59 configuration. Or you can run
60 .B "notmuch setup"
61 again to change the configuration.
62
63 The mail directory you specify can contain any number of
64 sub-directories and should primarily contain only files with individual
65 email messages (eg. maildir or mh archives are perfect). If there are
66 other, non-email files (such as indexes maintained by other email
67 programs) then notmuch will do its best to detect those and ignore
68 them.
69
70 Mail storage that uses mbox format, (where one mbox file contains many
71 messages), will not work with notmuch. If that's how your mail is
72 currently stored, it is recommended you first convert it to maildir
73 format with a utility such as mb2md before running
74 .B "notmuch setup" .
75
76 Invoking
77 .B notmuch
78 with no command argument will run
79 .B setup
80 if the setup command has not previously been completed.
81 .RE
82
83 The
84 .B new
85 command is used to incorporate new mail into the notmuch database.
86 .RS 4
87 .TP 4
88 .B new
89
90 Find and import any new messages to the database.
91
92 The
93 .B new
94 command scans all sub-directories of the database, performing
95 full-text indexing on new messages that are found. Each new message
96 will automatically be tagged with both the
97 .BR inbox " and " unread
98 tags.
99
100 You should run
101 .B "notmuch new"
102 once after first running
103 .B "notmuch setup"
104 to create the initial database. The first run may take a long time if
105 you have a significant amount of mail (several hundred thousand
106 messages or more). Subsequently, you should run
107 .B "notmuch new"
108 whenever new mail is delivered and you wish to incorporate it into the
109 database. These subsequent runs will be much quicker than the initial
110 run.
111
112 Note:
113 .B notmuch new
114 runs (other than the first run) will skip any read-only directories,
115 so you can use that to mark directories that will not receive any new
116 mail (and make
117 .B notmuch new
118 even faster).
119
120 Invoking
121 .B notmuch
122 with no command argument will run
123 .B new
124 if
125 .B "notmuch setup"
126 has previously been completed, but
127 .B "notmuch new"
128 has not previously been run.
129 .RE
130
131 Several of the notmuch commands accept search terms with a common
132 syntax. See the
133 .B "SEARCH SYNTAX"
134 section below for more details on the supported syntax.
135
136 The
137 .BR search " and "show
138 commands are used to query the email database.
139 .RS 4
140 .TP 4
141 .BR search " [options...] <search-term>..."
142
143 Search for messages matching the given search terms, and display as
144 results the threads containing the matched messages.
145
146 The output consists of one line per thread, giving a thread ID, the
147 date of the newest (or oldest, depending on the sort option) matched
148 message in the thread, the number of matched messages and total
149 messages in the thread, the names of all participants in the thread,
150 and the subject of the newest (or oldest) message.
151
152 Supported options for
153 .B search
154 include
155 .RS 4
156 .TP 4
157 .BR \-\-max\-threads= <value>
158
159 Restricts displayed search results to a subset of the complete results
160 that would match the terms. With this option, no more than <value>
161 thread results will be displayed. If this option is not used, then all
162 matching threads will be displayed. See also the
163 .B \-\-first
164 option.
165
166 .TP
167 .BR \-\-first= <value>
168
169 Omits the first <value> threads from the search results that would
170 otherwise be displayed. Together with the
171 .BR \-\-max\-threads
172 option, this can be used to perform incremental searches. For example,
173 the first 50 thread results can be displayed with
174 .B "\-\-first=0 \-\-max\-threads=50"
175 and the next 50 could be displayed with
176 .B "\-\-first=50 \-\-max\-threads=50"
177 etc.
178
179 .TP
180 .BR \-\-sort= ( newest\-first | oldest\-first )
181
182 This option can be used to present results in either chronological order
183 .RB ( oldest\-first )
184 or reverse chronological order
185 .RB ( newest\-first ).
186
187 Note: The thread order will be distinct between these two options
188 (beyond being simply reversed). When sorting by
189 .B oldest\-first
190 the threads will be sorted by the oldest message in each thread, but
191 when sorting by
192 .B newest\-first
193 the threads will be sorted by the newest message in each thread.
194
195 By default, results will be displayed in reverse chronological order,
196 (that is, the newest results will be displayed first).
197
198 See the
199 .B "SEARCH SYNTAX"
200 section below for details of the supported syntax for <search-terms>.
201 .RE
202 .TP
203 .BR show " <search-term>..."
204
205 Shows all messages matching the search terms.
206
207 The messages will be grouped and sorted based on the threading (all
208 replies to a particular message will appear immediately after that
209 message in date order). The output is not indented by default, but
210 depth tags are printed so that proper indentation can be performed by
211 a post-processor (such as the emacs interface to notmuch).
212
213 The  output format  is plain-text,  with all  text-content  MIME parts
214 decoded. Various components in the output,
215 .RB ( message ", " header ", " body ", " attachment ", and MIME " part ),
216 will be delimited by easily-parsed markers. Each marker consists of a
217 Control-L character (ASCII decimal 12), the name of the marker, and
218 then either an opening or closing brace, ('{' or '}'), to either open
219 or close the component.
220
221 A common use of
222 .B notmuch show
223 is to display a single thread of email messages. For this, use a
224 search term of "thread:<thread-id>" as can be seen in the first
225 column of output from the
226 .B notmuch search
227 command.
228
229 See the
230 .B "SEARCH SYNTAX"
231 section below for details of the supported syntax for <search-terms>.
232 .RE
233
234 The
235 .B reply
236 command is useful for preparing a template for an email reply.
237
238 .TP
239 .BR reply " <search-term>..."
240
241 Constructs a reply template for a set of messages.
242
243 To make replying to email easier,
244 .B notmuch reply
245 takes an existing set of messages and constructs a suitable mail
246 template. The Reply-to header (if any, otherwise From:) is used for
247 the To: address. Vales from the To: and Cc: headers are copied, but
248 not including any of the current user's email addresses (as configured
249 in primary_mail or other_email in the .notmuch-config file) in the
250 recipient list
251
252 It also builds a suitable new subject, including Re: at the front (if
253 not already present), and adding the message IDs of the messages being
254 replied to to the References list and setting the In-Reply-To: field
255 correctly.
256
257 Finally, the original contents of the emails are quoted by prefixing
258 each line with '> ' and included in the body.
259
260 The resulting message template is output to stdout.
261
262 See the
263 .B "SEARCH SYNTAX"
264 section below for details of the supported syntax for <search-terms>.
265
266 Note: It is most common to use
267 .B "notmuch reply"
268 with a search string matching a single message, (such as
269 id:<message-id>), but it can be useful to reply to several messages at
270 once. For example, when a series of patches are sent in a single
271 thread, replying to the entire thread allows for the reply to comment
272 on issue found in multiple patches.
273 .RE
274
275 The
276 .B tag
277 command is the only command available for manipulating database
278 contents.
279
280 .RS 4
281 .TP 4
282 .BR tag " +<tag>|-<tag> [...] [--] <search-term>..."
283
284 Add/remove tags for all messages matching the search terms.
285
286 Tags prefixed by '+' are added while those prefixed by '-' are
287 removed. For each message, tag removal is performed before tag
288 addition.
289
290 The beginning of <search-terms> is recognized by the first
291 argument that begins with neither '+' nor '-'. Support for
292 an initial search term beginning with '+' or '-' is provided
293 by allowing the user to specify a "--" argument to separate
294 the tags from the search terms.
295
296 See the
297 .B "SEARCH SYNTAX"
298 section below for details of the supported syntax for <search-terms>.
299 .RE
300
301 The
302 .BR dump " and " restore
303 commands can be used to create a textual dump of email tags for backup
304 purposes, and to restore from that dump
305
306 .RS 4
307 .TP 4
308 .BR dump " [<filename>]"
309
310 Creates a plain-text dump of the tags of each message.
311
312 The output is to the given filename, if any, or to stdout.
313
314 These tags are the only data in the notmuch database that can't be
315 recreated from the messages themselves.  The output of notmuch dump is
316 therefore the only critical thing to backup (and much more friendly to
317 incremental backup than the native database files.)
318 .TP
319 .BR restore " <filename>"
320
321 Restores the tags from the given file (see
322 .BR "notmuch dump" "."
323
324 Note: The dump file format is specifically chosen to be
325 compatible with the format of files produced by sup-dump.
326 So if you've previously been using sup for mail, then the
327 .B "notmuch restore"
328 command provides you a way to import all of your tags (or labels as
329 sup calls them).
330 .SH SEARCH SYNTAX
331 Several notmuch commands accept a common syntax for search terms.
332
333 The search terms can consist of free-form text (and quoted phrases)
334 which will match all messages that contain all of the given
335 terms/phrases in the body, the subject, or any of the sender or
336 recipient headers.
337
338 In addition to free text, the following prefixes can be used to force
339 terms to match against specific portions of an email, (where
340 <brackets> indicate user-supplied values):
341
342         from:<name-or-address>
343
344         to:<name-or-address>
345
346         subject:<word-or-quoted-phrase>
347
348         attachment:<word>
349
350         tag:<tag>
351
352         id:<message-id>
353
354         thread:<thread-id>
355
356 The
357 .B from:
358 prefix is used to match the name or address of the sender of an email
359 message.
360
361 The
362 .B to:
363 prefix is used to match the names or addresses of any recipient of an
364 email message, (whether To, Cc, or Bcc).
365
366 Any term prefixed with
367 .B subject:
368 will match only text from the subject of an email. Searching for a
369 phrase in the subject is supported by including quotation marks around
370 the phrase, immediately following
371 .BR subject: .
372
373 The
374 .B attachment:
375 prefix can be used to search for specific filenames (or extensions) of
376 attachments to email messages.
377
378 For
379 .BR tag: ,
380 valid tag values include
381 .BR inbox " and " unread
382 by default for new messages added by
383 .B notmuch new
384 as well as any other tag values added manually with
385 .BR "notmuch tag" .
386
387 For
388 .BR id: ,
389 message ID values are the literal contents of the Message-ID: header
390 of email messages, but without the '<', '>' delimiters.
391
392 The
393 .B thread:
394 prefix can be used with the thread ID values that are generated
395 internally by notmuch (and do not appear in email messages). These
396 thread ID values can be seen in the first column of output from
397 .B "notmuch search"
398
399 In addition to individual terms, multiple terms can be
400 combined with Boolean operators (
401 .BR and ", " or ", " not
402 , etc.). Each term in the query will be implicitly connected by a
403 logical AND if no explicit operator is provided, (except that terms
404 with a common prefix will be implicitly combined with OR until we get
405 Xapian defect #402 fixed).
406
407 Parentheses can also be used to control the combination of the Boolean
408 operators, but will have to be protected from interpretation by the
409 shell, (such as by putting quotation marks around any parenthesized
410 expression).
411
412 Finally, results can be restricted to only messages within a
413 particular time range, (based on the Date: header) with a syntax of:
414
415         <intial-timestamp>..<final-timestamp>
416
417 Each timestamp is a number representing the number of seconds since
418 1970-01-01 00:00:00 UTC. This is not the most convenient means of
419 expressing date ranges, but until notmuch is fixed to accept a more
420 convenient form, one can use the date program to construct
421 timestamps. For example, with the bash shell the folowing syntax would
422 specify a date range to return messages from 2009-10-01 until the
423 current time:
424
425         $(date +%s -d 2009-10-01)..$(date +%s)
426 .SH SEE ALSO
427 The emacs-based interface to notmuch (available as
428 .B notmuch.el
429 in the Notmuch distribution).
430
431 The notmuch website:
432 .B http://notmuchmail.org
433 .SH CONTACT
434 Feel free to send questions, comments, or kudos to the notmuch mailing
435 list <notmuch@notmuchmail.org> . Subscription is not required before
436 posting, but is available from the notmuchmail.org website.
437
438 Real-time interaction with the Notmuch community is available via IRC
439 (server: irc.freenode.net, channel: #notmuch).