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