MYMAIL

Section: User Commands (0.9.10)
Updated: July 2014
Index

 

NAME

mymail - A simple command line utility for indexing and searching mbox files

 

SYNOPSIS

mymail [options] [<mbox dir1> [<mbox dir2> ... ]|<db file1> [<db file2> ... ]]

 

DESCRIPTION

mymail is a command line utility to index mbox files, search for mails based on sender, subject, etc. and generate result mbox files.

It is similar in spirit to other tools such as mu or notmuch, but is overall simpler.

 

OPTIONS

-h, --help
display help and exit
-v, --version
print the version number
-q, --quiet
do not write information during the search
-t, --use-leading-time
use the time stamp from the leading line of each mail and not the Date: field
-f, --do-not-discard-mails-from-the-future
keep mails with a date (more than 24h) in the future, which are discarded by default
-p <db filename pattern>, --db-pattern <db filename pattern>
set the db filename pattern for recursive search
-r <db root path>, --db-root <db root path>
set the db root path for recursive search
-l <db filename list>, --db-list <db filename list>
set the semicolon-separated list of db files for search
-m <mbox filename pattern>, --mbox-pattern <mbox filename pattern>
set the mbox filename pattern for recursive search
-s <search pattern>, --search <search pattern>
search for matching mails in the db file. Multiple search requests can be combined, and only mails fulfilling all of them will be extracted.
-d <db filename>, --db-file-output <db filename>
set the db filename for indexing
-i, --index
index mails in the mailboxes located recursively anywhere in the directories following the options on the command lines
-o <output filename>, --output <output filename>
set the result mbox filename. If it is not set, the standard output is used
-n <max number of mails>, --nb-mails-max <max number of mails>
set the maximum number of mails to extract (default is 250)
-a <search key>, --default-search <search key>
set the default search key. If a search request is not understood, it is interpreted as the regexp with this default search key

 

ENVIRONMENT VARIABLES

MYMAIL_DB_PATTERN
defaut value for the --db-pattern argument
MYMAIL_DB_ROOT
defaut value for the --db-root argument
MYMAIL_DB_LIST
defaut value for the --db-list argument
MYMAIL_DB_FILE
defaut value for the --db-file-output argument
MYMAILRC
configuration file, default is ${HOME}/.mymailrc

 

SEARCH CONDITIONS

A search condition is either a time-related condition ('today', 'yesterday', etc.), or a single-character key, followed by a space and a regexp, which can itself contain spaces.

If it is prefaced by the character "!", a condition is negated and has to be false for a mail to be selected.

f <regexp> (from)
selects mails whose leading line 'From', or fields From:, Sender:, Reply-To:, or Return-Path: matches the regexp.
t <regexp> (to)
selects mails whose field To:, Cc:, or Bcc: matches the regexp.
p <regexp> (participant)
selects mails that would be selected by f or t.
s <regexp> (subject)
selects mails whose field Subject: matches the regexp.
d <regexp> (date)
selects mails whose field Date: matches the regexp.
b <regexp> (body)
selects mails whose body matches the regexp. Evaluating such a condition requires to read the full mail from the original mboxes, which can be slow. To speed things up, all the header conditions are checked first.
1h, 2h, 4h, 8h, 24h, 48h, week, 2weeks, month, trimester, semester, and year
select mails received during the last 1, 2, 4, 8, 24, 48, 7 * 24 hours, 14 * 24 hours, 31 * 24 hours, 92 * 24 hours, 185 * 24 hours, and 365 * 24 hours respectively.
today
selects mails received since midnight.
yesterday
selects mails received yesterday.
monday, tuesday, ..., sunday
select mails received the most recent such day of the week.

 

EXAMPLES

The command

mymail --db-file-output /tmp/mymail/2010-2011/mymail.db \
       --index \
       ~/archives/mails/2010 ~/archives/mails/2011

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

mymail --db-pattern '.db$' --db-root /tmp/mymail \
       --output /tmp/mymail.mbox \
       --search 'p bob.something' \
       --search '!s spam' \
       --search 'month'

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.

 

FILES

The configuration file is by default ${HOME}/.mymailrc and can also be specified through the MYMAILRC environment variable.

It allows to define aliases of search keys, such as:

alias tod=today

 

BUGS

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' may not always be quoted properly, so mymail uses a strict regexp to recognize such lines.

The date format for the Date: field is not standardized, and may not be parsed properly. When that happens, the time stamp from the leading 'From' line of the mail, which has a canonical form, is used.

 

AUTHOR

Written by Francois Fleuret <francois@fleuret.org> and distributed under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ENVIRONMENT VARIABLES
SEARCH CONDITIONS
EXAMPLES
FILES
BUGS
AUTHOR
This document was created by using the manual pages.
Time: 01:13:50 GMT, April 20, 2024