Changed indentation to avoid a gcc warning.
[mymail.git] / mymail.1
1 .TH "MYMAIL" "0.9.10" "July 2014" "Francois Fleuret" "User Commands"
2
3 \" This man page was written by Francois Fleuret <francois@fleuret.org>
4 \" and is distributed under a Creative Commons Attribution-Share Alike
5 \" 3.0 License.
6
7 .SH "NAME"
8
9 mymail \- A simple command line utility for indexing and searching mbox files
10
11 .SH "SYNOPSIS"
12
13 \fBmymail\fP [\fIoptions\fR] [\fI<mbox dir1>\fR [\fI<mbox dir2>\fR ... ]|\fI<db file1>\fR [\fI<db file2>\fR ... ]]
14
15 .SH "DESCRIPTION"
16
17 \fBmymail\fP is a command line utility to index mbox files, search for
18 mails based on sender, subject, etc. and generate result mbox files.
19
20 It is similar in spirit to other tools such as mu or notmuch, but is
21 overall simpler.
22
23 .SH "OPTIONS"
24 .TP
25 \fB-h\fR, \fB--help\fR
26 display help and exit
27 .TP
28 \fB-v\fR, \fB--version\fR
29 print the version number
30 .TP
31 \fB-q\fR, \fB--quiet\fR
32 do not write information during the search
33 .TP
34 \fB-t\fR, \fB--use-leading-time\fR
35 use the time stamp from the leading line of each mail and not the
36 Date: field
37 .TP
38 \fB-f\fR, \fB--do-not-discard-mails-from-the-future\fR
39 keep mails with a date (more than 24h) in the future, which are
40 discarded by default
41 .TP
42 \fB-p <db filename pattern>\fR, \fB--db-pattern <db filename pattern>\fR
43 set the db filename pattern for recursive search
44 .TP
45 \fB-r <db root path>\fR, \fB--db-root <db root path>\fR
46 set the db root path for recursive search
47 .TP
48 \fB-l <db filename list>\fR, \fB--db-list <db filename list>\fR
49 set the semicolon-separated list of db files for search
50 .TP
51 \fB-m <mbox filename pattern>\fR, \fB--mbox-pattern <mbox filename pattern>\fR
52 set the mbox filename pattern for recursive search
53 .TP
54 \fB-s <search pattern>\fR, \fB--search <search pattern>\fR
55 search for matching mails in the db file. Multiple search requests can
56 be combined, and only mails fulfilling all of them will be extracted.
57 .TP
58 \fB-d <db filename>\fR, \fB--db-file-output <db filename>\fR
59 set the db filename for indexing
60 .TP
61 \fB-i\fR, \fB--index\fR
62 index mails in the mailboxes located recursively anywhere in the
63 directories following the options on the command lines
64 .TP
65 \fB-o <output filename>\fR, \fB--output <output filename>\fR
66 set the result mbox filename. If it is not set, the standard output is
67 used
68 .TP
69 \fB-n <max number of mails>\fR, \fB--nb-mails-max <max number of mails>\fR
70 set the maximum number of mails to extract (default is 250)
71 .TP
72 \fB-a <search key>\fR, \fB--default-search <search key>\fR
73 set the default search key. If a search request is not understood,
74 it is interpreted as the regexp with this default search key
75
76 .SH "ENVIRONMENT VARIABLES"
77
78 .TP
79 \fBMYMAIL_DB_PATTERN\fR
80 defaut value for the --db-pattern argument
81 .TP
82 \fBMYMAIL_DB_ROOT\fR
83 defaut value for the --db-root argument
84 .TP
85 \fBMYMAIL_DB_LIST\fR
86 defaut value for the --db-list argument
87 .TP
88 \fBMYMAIL_DB_FILE\fR
89 defaut value for the --db-file-output argument
90 .TP
91 \fBMYMAILRC \fR
92 configuration file, default is ${HOME}/.mymailrc
93
94 .SH "SEARCH CONDITIONS"
95
96 A search condition is either a time-related condition
97 ('today', 'yesterday', etc.), or a single-character key, followed by a
98 space and a regexp, which can itself contain spaces.
99
100 If it is prefaced by the character "!", a condition is negated and has
101 to be false for a mail to be selected.
102
103 .TP
104 \fBf <regexp>\fR (from)
105 selects mails whose leading line 'From', or fields From:, Sender:,
106 Reply-To:, or Return-Path: matches the regexp.
107 .TP
108 \fBt <regexp>\fR (to)
109 selects mails whose field To:, Cc:, or Bcc: matches the regexp.
110 .TP
111 \fBp <regexp>\fR (participant)
112 selects mails that would be selected by \fBf\fR or \fBt\fR.
113 .TP
114 \fBs <regexp>\fR (subject)
115 selects mails whose field Subject: matches the regexp.
116 .TP
117 \fBd <regexp>\fR (date)
118 selects mails whose field Date: matches the regexp.
119 .TP
120 \fBb <regexp>\fR (body)
121 selects mails whose body matches the regexp. Evaluating such a
122 condition requires to read the full mail from the original mboxes,
123 which can be slow. To speed things up, all the header conditions are
124 checked first.
125 .TP
126 \fB1h\fR, \fB2h\fR, \fB4h\fR, \fB8h\fR, \fB24h\fR, \fB48h\fR, \fBweek\fR, \fB2weeks\fR, \fBmonth\fR, \fBtrimester\fR, \fBsemester\fR, and \fByear\fR
127 select mails received during the last
128 1, 2, 4, 8, 24, 48, 7 * 24 hours, 14 * 24 hours, 31 * 24 hours, 92 *
129 24 hours, 185 * 24 hours, and 365 * 24 hours respectively.
130 .TP
131 \fBtoday\fR
132 selects mails received since midnight.
133 .TP
134 \fByesterday\fR
135 selects mails received yesterday.
136 .TP
137 \fBmonday\fR, \fBtuesday\fR, ..., \fBsunday\fR
138 select mails received the most recent such day of the week.
139
140 .SH "EXAMPLES"
141
142 The command
143
144 .P
145 .nf
146 .B mymail --db-file-output /tmp/mymail/2010-2011/mymail.db \e
147 .B \ \ \ \ \ \ \ --index \e
148 .B \ \ \ \ \ \ \ ~/archives/mails/2010 ~/archives/mails/2011
149
150 .fi
151 will index all the mbox files present in the directories
152 ~/archives/mails/2010 and ~/archives/mails/2011 (recursively) and
153 create an index file /tmp/mymail/2010-2011/mymail.db
154
155 And
156
157 .P
158 .nf
159 .B mymail --db-pattern '\.db$' --db-root /tmp/mymail \e
160 .B \ \ \ \ \ \ \ --output /tmp/mymail.mbox \e
161 .B \ \ \ \ \ \ \ --search 'p bob.something' \e
162 .B \ \ \ \ \ \ \ --search '!s spam' \e
163 .B \ \ \ \ \ \ \ --search 'month'
164
165 .fi
166 will search in all the database files *.db located (recursively) in
167 /tmp/mymail, for all the mails having "bob.something" as sender or
168 recipient, without "spam" in the subject, received over the last 31
169 days, and create an mbox file /tmp/mymail/mbox.
170
171 .SH "FILES"
172
173 The configuration file is by default ${HOME}/.mymailrc and can also be
174 specified through the MYMAILRC environment variable.
175
176 It allows to define aliases of search keys, such as:
177
178 .P
179 .nf
180 .B alias tod=today
181
182 .SH "BUGS"
183
184 The search in the mail bodies does not decode mimencoding mails, hence
185 will not catch patterns in encoded text.
186
187 The mbox format is not clear for multipart messages, since the 'From'
188 may not always be quoted properly, so mymail uses a strict regexp to
189 recognize such lines.
190
191 The date format for the Date: field is not standardized, and may not
192 be parsed properly. When that happens, the time stamp from the
193 leading 'From' line of the mail, which has a canonical form, is used.
194
195 .SH "AUTHOR"
196
197 Written by Francois Fleuret <francois@fleuret.org> and distributed
198 under the terms of the GNU General Public License version 3 as
199 published by the Free Software Foundation. This is free software: you
200 are free to change and redistribute it. There is NO WARRANTY, to the
201 extent permitted by law.