-.TH "MYMAIL" "0.9" "February 2013" "Francois Fleuret" "User Commands"
+.TH "MYMAIL" "0.9.2" "February 2013" "Francois Fleuret" "User Commands"
\" This man page was written by Francois Fleuret <francois@fleuret.org>
\" and is distributed under a Creative Commons Attribution-Share Alike
.SH "SYNOPSIS"
-\fBmymail\fP [\fIoptions\fR] [\fI<mbox dir1>\fR [\fI<mbox dir2>\fR ...]]
+\fBmymail\fP [\fIoptions\fR] [\fI<mbox dir1>\fR [\fI<mbox dir2>\fR ... ]|\fI<db file1>\fR [\fI<db file2>\fR ... ]]\n");
.SH "DESCRIPTION"
-\fBmymail\fP is a command line utility for to index mbox files and
-perform quick searches based on sender, subject, etc.
+\fBmymail\fP is a command line utility to index mbox files and perform
+quick searches based on sender, subject, etc.
It is similar in spirit to other existing software such as mu or
-notmuch.
+notmuch, but does not use a real database backend to store and query
+the index.
+
+.SH "OPTIONS"
+.TP
+\fB-h\fR, \fB--help\fR
+display help and exit
+.TP
+\fB-v\fR, \fB--version\fR
+print the version number
+.TP
+\fB-q\fR, \fB--quiet\fR
+do not write information during the search
+.TP
+\fB-p <db filename pattern>\fR, \fB--db-pattern <db filename pattern>\fR
+set the db filename pattern for recursive search
+.TP
+\fB-r <db root path>\fR, \fB--db-root <db root path>\fR
+set the db root path for recursive search
+.TP
+\fB-l <db filename list>\fR, \fB--db-list <db filename list>\fR
+set the semicolon-separated list of db files for search
+.TP
+\fB-s <search pattern>\fR, \fB--search <search pattern>\fR
+search for matching mails in the db file
+.TP
+\fB-d <db filename>\fR, \fB--db-file <db filename>\fR
+set the db filename for indexing
+.TP
+\fB-i\fR, \fB--index\fR
+index mails in the mailboxes located recursively anywhere in the
+directories following the options on the command lines
+.TP
+\fB-o <output filename>\fR, \fB--output <output filename>\fR
+set the db filename pattern for recursive search
+.TP
+\fB-a <search field>\fR, \fB--default-search <search field>\fR
+set the default search field: If a search request is not understood,
+it is interpreted as the regexp with this default search field
+
+.SH "ENVIRONMENT VARIABLES"
+
+.TP
+\fBMYMAIL_DB_PATTERN\fR
+defaut value for the --db-pattern argument
+.TP
+\fBMYMAIL_DB_ROOT\fR
+defaut value for the --db-root argument
+.TP
+\fBMYMAIL_DB_LIST\fR
+defaut value for the --db-list argument
+.TP
+\fBMYMAIL_DB_FILE\fR
+defaut value for the --db-file argument
.SH "SEARCH SYNTAX"
for a mail to be selected.
.TP
-\fBf <regexp>\fR selects mails whose field From, From:, or Reply-To: matches the regexp. Since the initial "From " line contains the date, this search criterion can be used to restrict to a certain year or month.
+\fBf <regexp>\fR (from) selects mails whose leading line From, or
+fields From:, Sender:, Reply-To:, or Return-Path: matches the regexp.
+.TP
+\fBt <regexp>\fR (to) selects mails whose field To:, Cc:, or Bcc: matches the regexp.
+.TP
+\fBp <regexp>\fR (participant) selects mails that would be selected by \fBf\fR or \fBt\fR.
.TP
-\fBd <regexp>\fR selects mails whose field To:, Cc:, or Bcc: matches the regexp.
+\fBs <regexp>\fR (subject) selects mails whose field Subject: matches the regexp.
.TP
-\fBp <regexp>\fR selects mails whose field From, From:, Reply-To:, To:, Cc:, or Bcc: matches the regexp.
+\fBd <regexp>\fR (date) selects mails whose field Date: matches the regexp.
.TP
-\fBs <regexp>\fR selects mails whose field Subject: matches the regexp.
+\fBb <regexp>\fR (body) selects mails whose body matches the
+regexp. Evaluatin such a condition requires to read the original
+mboxes completely, which can be slow. However, header conditions are
+checked first to read the bodies only for mails which fulfill them
+entirely.
+.TP
+\fB8h\fR, \fBtoday\fR, \fB24h\fR, \fBweek\fR, \fBmonth\fR, and
+\fByear\fR selects mails received during the last 8, 24, 24, 7 * 24
+hours, 31 * 24 hours, and 365 * 24 hours respectively.
+.TP
+\fByesterday\fR selects mails received between 48h and 24h ago.
+.TP
+\fBmonday\fR, \fBtuesday\fR, ..., \fBsunday\fR selects mails received
+the most recent such day
.SH "EXAMPLES"
-To index all the mbox present in the directory ~/my_mboxes and create
-a db file /tmp/mymail.db
+The command
.RS
.EX
-mymail --index --db-file /tmp/mymail.db /tmp/my_mboxes
+mymail --db-file /tmp/mymail/2010-2011/mymail.db \\
+ --index \\
+ ~/archives/mails/2010 ~/archives/mails/2011
.EE
.RE
-To search in /tmp/mymail_2010.db and /tmp/mymail_2011.db for all mails
-having bob.something as sender or recipient, without "spam" in the
-subject
+will index all the mbox files present in the directories
+~/archives/mails/2010 and ~/archives/mails/2011 (recursively) and
+create an index file /tmp/mymail/2010-2011/mymail.db
+
+And
.RS
.EX
-mymail --search "p bob.something,!s spam" /tmp/mymail_2010.db /tmp/mymail_2011.db
+mymail --db-pattern '\.db$' --db-root /tmp/mymail \\
+ --output /tmp/mymail.mbox \\
+ --search 'p bob.something' \\
+ --search '!s spam' \\
+ --search 'month'
.EE
.RE
+will search in all the database files *.db located (recursively) in
+/tmp/mymail, for all the mails having "bob.something" as sender or
+recipient, without "spam" in the subject, received over the last 31
+days, and create an mbox file /tmp/mymail/mbox.
+
.SH "BUGS"
-None known, probably many.
+The search in the mail bodies does not decode mimencoding mails, hence
+will not catch patterns in encoded text.
+
+The mbox format is not clear for multipart messages, since the ^"From
+" lines are not always quoted properly (at least the ones I have to
+test).
.SH "AUTHOR"