mairix decides whether indexing or searching is required by looking for the presence of any search-patterns on the command line.
Specialmodes-h,--help
Show usage summary and exit
-V,--version
Show program version and exit
-d
Dump the database's contents in human-readable form to stdout.
Generaloptions-fmairixrc--rcfilemairixrc
Specify an alternative configuration file to use. The default configuration file is ~/.mairixrc.
-v,--verbose
Make the output more verbose
-Q,--no-integrity-checks
Normally mairix will do some internal integrity tests on the database. The -Q option removes
these checks, making mairix run faster, but it will be less likely to detect internal problems if
any bugs creep in.
The nochecks directive in the rc file has the same effect.
--unlockmairix locks its database file during any indexing or searching operation to prevent multiple
indexing runs interfering with each other, or an indexing run interfering with search runs. The
--unlock option removes the lockfile before doing the requested indexing or searching operation.
This is a convenient way of cleaning up a stale lockfile if an earlier run crashed for some reason
or was aborted.
Indexingoptions-p,--purge
Cause stale (dead) messages to be purged from the database during an indexing run. (Normally,
stale messages are left in the database because of the additional cost of compacting away the
storage that they take up.)
-F,--fast-index
When processing maildir and MH folders, mairix normally compares the mtime and size of each
message against the values stored in the database. If they have changed, the message will be
rescanned. This check requires each message file to be stat'ed. For large numbers of messages in
these folder types, this can be a sizeable overhead.
This option tells mairix to assume that when a message currently on-disc has a name matching one
already in the database, it should assume the message is unchanged.
A later indexing run without using this option will fix up any rescans that were missed due to its
use.
--force-hash-key-new-databasehash
This option should only be used for debugging.
If a new database is created, hash is used as hash key, instead of a random hash.
Searchoptions-a,--augment
Append newly matches messages to the current mfolder instead of creating the mfolder from scratch.
-t,--threads
As well as returning the matched messages, also return every message in the same thread as one of
the real matches.
-r,--raw-output
Instead of creating an mfolder containing the matched messages, just show their paths on stdout.
-x,--excerpt-output
Instead of creating an mfolder containing the matched messages, display an excerpt from their
headers on stdout. The excerpt shows To, Cc, From, Subject and Date. With IMAP source folders,
this requires downloading each matched message from the IMAP server.
-H,--force-hardlinks
Instead of creating symbolic links, force the use of hardlinks. This helps mailers such as alpine
to realize that there are new mails in the search folder.
-omfolder--mfoldermfolder
Specify a temporary alternative path for the mfolder to use, overriding the mfolder directive in
the rc file.
mairix will refuse to output search results into any folder that appears to be amongst those that
are indexed. This is to prevent accidental deletion of emails.
Searchpatternst:word
Match word in the To: header.
c:word
Match word in the Cc: header.
f:word
Match word in the From: header.
s:word
Match word in the Subject: header.
m:word
Match word in the Message-ID: header.
b:word
Match word in the message body.
Messagebody is taken to mean any body part of type text/plain or text/html. For text/html, text
within meta tags is ignored. In particular, the URLs inside <A HREF="..."> tags are not currently
indexed. Non-text attachments are ignored. If there's an attachment of type message/rfc822, this
is parsed and the match is performed on this sub-message too. If a hit occurs, the enclosing
message is treated as having a hit.
d:[start-datespec]-[end-datespec]
Match messages with Date: headers lying in the specific range.
z:[low-size]-[high-size]
Match messages whose size lies in the specified range. If the low-size argument is omitted it
defaults to zero. If the high-size argument is omitted it defaults to infinite size.
For example, to match messages between 10kilobytes and 20kilobytes in size, the following search
term can be used:
mairix z:10k-20k
The suffix 'k' on a number means multiply by 1024, and the suffix 'M' on a number means multiply
by 1024*1024.
n:word
Match word occurring as the name of an attachment in the message. Since attachment names are
usually long, this option would usually be used in the substring form. So
mairix n:mairix=
would match all messages which have attachments whose names contain the substring mairix.
The attachment name is determined from the name=xxx or filename=xxx qualifiers on the Content-
Type: and Content-Disposition: headers respectively.
F:flags
Match messages with particular flag settings. The available flags are 's' meaning seen, 'r'
meaning replied, and 'f' meaning flagged. The flags are case-insensitive. A flag letter may be
prefixed by a '-' to negate its sense. Thus
mairix F:-s d:1w-
would match any unread message less than a week old, and
mairix F:f-r d:-1m
would match any flagged message older than a month which you haven't replied to yet.
Note that the flag characters and their meanings agree with those used as the suffix letters on
message filenames in maildir folders.
Searchingforamatchamongstmorethanonepartofamessage
Multiple body parts may be grouped together, if a match in any of them is sought. Common examples
follow.
tc:word
Match word in either the To: or Cc: headers (or both).
bs:word
Match word in either the Subject: header or the message body (or both).
The a: search pattern is an abbreviation for tcf:; i.e. match the word in the To:, Cc: or From: headers.
("a" stands for "address" in this case.)
Matchwords
The word argument to the search strings can take various forms.
~word
Match messages not containing the word.
word1,word2
This matches if both the words are matched in the specified message part.
word1/word2
This matches if either of the words are matched in the specified message part.
substring=
Match any word containing substring as a substring
substring=N
Match any word containing substring, allowing up to N errors in the match. For example, if N is
1, a single error is allowed, where an error can be
* a missing letter
* an extra letter
* a different letter.
^substring=
Match any word containing substring as a substring, with the requirement that substring occurs at
the beginning of the matched word.
Precedencematters
The binding order of the constructions is:
1. Individual command line arguments define separate conditions which are AND-ed together
2. Within a single argument, the letters before the colon define which message parts the expression
applies to. If there is no colon, the expression applies to all the headers listed earlier and
the body.
3. After the colon, slashes delineate separate disjuncts, which are OR-ed together.
4. Each disjunct may contain separate conjuncts, which are separated by commas. These conditions are
AND-ed together.
5. Each conjunct may start with a tilde to negate it, and may be followed by a slash to indicate a
substring match, optionally followed by an integer to define the maximum number of errors allowed.
Datespecification
This section describes the syntax used for specifying dates when searching using the `d:' option.
Dates are specified as a range. The start and end of the range can both be specified. Alternatively, if
the start is omitted, it is treated as being the beginning of time. If the end is omitted, it is treated
as the current time.
There are 4 basic formats:
d:start-end
Specify both start and end explicitly
d:start-
Specify start, end is the current time
d:-end Specify end, start is 'a long time ago' (i.e. early enough to include any message).
d:period
Specify start and end implicitly, as the start and end of the period given.
The start and end can be specified either absolute or relative. A relative endpoint is given as a number
followed by a single letter defining the scaling:
┌─────────┬─────────────┬───────────┬───────────────────────┐
│ letter │ shortfor │ example │ meaning │
├─────────┼─────────────┼───────────┼───────────────────────┤
│ d │ days │ 3d │ 3 days │
│ w │ weeks │ 2w │ 2 weeks (14 days) │
│ m │ months │ 5m │ 5 months (150 days) │
│ y │ years │ 4y │ 4 years (4*365 days) │
└─────────┴─────────────┴───────────┴───────────────────────┘
Months are always treated as 30 days, and years as 365 days, for this purpose.
Absolute times can be specified in many forms. Some forms have different meanings when they define a
start date from that when they define an end date. Where a single expression specifies both the start
and end (i.e. where the argument to d: doesn't contain a `-'), it will usually have different
interpretations in the two cases.
In the examples below, suppose the current date is Sunday May 18th, 2003 (when I started to write this
material.)
┌──────────────────────┬──────────────────────┬───────────────────────┬─────────────────────────────────┐
│ Example │ Start date │ End date │ Notes │
├──────────────────────┼──────────────────────┼───────────────────────┼─────────────────────────────────┤
│ d:20030301-20030425 │ March 1st, 2003 │ 25th April, 2003 │ │
│ d:030301-030425 │ March 1st, 2003 │ April 25th, 2003 │ century assumed │
│ d:mar1-apr25 │ March 1st, 2003 │ April 25th, 2003 │ │
│ d:Mar1-Apr25 │ March 1st, 2003 │ April 25th, 2003 │ case insensitive │
│ d:MAR1-APR25 │ March 1st, 2003 │ April 25th, 2003 │ case insensitive │
│ d:1mar-25apr │ March 1st, 2003 │ April 25th, 2003 │ date and month in either order │
│ d:2002 │ January 1st, 2002 │ December 31st, 2002 │ whole year │
│ d:mar │ March 1st, 2003 │ March 31st, 2003 │ most recent March │
│ d:oct │ October 1st, 2002 │ October 31st, 2002 │ most recent October │
│ d:21oct-mar │ October 21st, 2002 │ March 31st, 2003 │ start before end │
│ d:21apr-mar │ April 21st, 2002 │ March 31st, 2003 │ start before end │
│ d:21apr- │ April 21st, 2003 │ May 18th, 2003 │ end omitted │
│ d:-21apr │ January 1st, 1900 │ April 21st, 2003 │ start omitted │
│ d:6w-2w │ April 6th, 2003 │ May 4th, 2003 │ both dates relative │
│ d:21apr-1w │ April 21st, 2003 │ May 11th, 2003 │ one date relative │
│ d:21apr-2y │ April 21st, 2001 │ May 11th, 2001 │ start before end │
│ d:99-11 │ January 1st, 1999 │ May 11th, 2003 │ 2 digits are a day of the month │
│ │ │ │ if possible, otherwise a year │
│ d:99oct-1oct │ October 1st, 1999 │ October 1st, 2002 │ end before now, single digit is │
│ │ │ │ a day of the month │
│ d:99oct-01oct │ October 1st, 1999 │ October 31st, 2001 │ 2 digits starting with zero │
│ │ │ │ treated as a year │
│ d:oct99-oct1 │ October 1st, 1999 │ October 1st, 2002 │ day and month in either order │
│ d:oct99-oct01 │ October 1st, 1999 │ October 31st, 2001 │ year and month in either order │
└──────────────────────┴──────────────────────┴───────────────────────┴─────────────────────────────────┘
The principles in the table work as follows.
• When the expression defines a period of more than a day (i.e. if a month or year is specified),
the earliest day in the period is taken when the start date is defined, and the last day in the
period if the end of the range is being defined.
• The end date is always taken to be on or before the current date.
• The start date is always taken to be on or before the end date.