On the mailbox screen, you can quickly search for messages containing a particular string by entering the string into the search text box and hitting the Enter key.
By default, it will search all folders and search the From, To, Cc and Subject headers as well as the message body content. It will not search the content of email attachments.
The searching will only search for complete words/terms, not substrings (see "substr" option below if you want to search for sub strings) but will find different stemmed endings. e.g. searching for "condition" will find messages with condition, conditions, conditional, conditionally, etc.
You can build advanced searches using a special syntax in the standard search box on the Mailbox screen. This is done by using special keywords, boolean flags and operators to combine multiple options together.
The possible keywords are:
- to:<phrase> (really both to/cc)
- flag:<flag name>
- since|after|newer:<date spec>
- before|older:<date spec>
- date:<date spec>
- smaller|maxsize:<size spec>
- bigger|larger|minsize:<size spec>
- header:"headername: phrase"
- substr:(other search terms)
- imap:<raw imap search>
Phrases are matched on a complete basis with stemming, as in the simple search above.
Date spec can be quite flexible, either a particular date (e.g.
date:"30 sep 2010")
or a relative date (e.g.
date:"2 weeks ago"). Internally it uses perl's Date::Manip
module. It also supports integers with units, d (day), w (week), m (month) or y (year).
date:2w is equivalent to
date:"2 weeks ago"
If you want a phrase with spaces in it, use quotes (either ' or ", but matched) for the phrase part,
from:"Joe Citizen" or
subject:'string with "double" quotes',
"from:Joe Citizen" or
subject:"must end with same'. You can also use \", \'
and \\ to match a literal ", ' and \ respectively in a phrase.
Size is specified in bytes with optional suffix (k, m, g) - e.g.
Header is specified with a quote, e.g.
When using substr, any search terms within are searched on a "contains" basis.
means even partial words or within words will match. eg
will match an email from "Robert" because "ber" is contained in "Robert". Please
note that searching substrings will be significantly slower than regular searches.
The filetype specification finds emails with attachments of the given type. It does that by looking at the MIME type of the attachments. It's possible some systems generate emails with attachments with the wrong or "missing" MIME types, in which case the search may unfortunately fail to find the expected emails.
These match messages that match a particular state (eg. read or unread or flagged or ...).
These must all be specified in UPPERCASE to distinguish
them from normal search words. Alternatively, you can use
in which case BOOLEAN is case-insensitive. This is for compatibility with
- SEEN | READ
- UNSEEN | UNREAD
- REPLIED | ANSWERED
- UNREPLIED | UNANSWERED
- HASATT | ATTACHMENT
- HASNOATT | NOATT | NOATTACHMENT
UNSEEN HASATT or
is:unseen has:attachment will show all unread messages with attachments.
Operators must also be uppercase
- AND - doesn't do anything, since this is the default when multiple keywords/booleans are specified
- OR - e.g.
from:rob OR from:jeremy. Applies just to the terms on either side.
- NOT - applies just to the term afterwards, e.g. has Rob emailed me about anything else this week?
since:"1 week ago" from:rob NOT subject:"new web interface"
- () - grouping, e.g.
(from:rob subject:"new web interface") OR subject:urgent
After performing a search, the search term appears in the sidebar on the left of the screen. Click the "Save" button next to the search term to save it.
A value in imap:"..." is passed directly to the IMAP server. See the IMAP specification for full details. Here is a quick reference of the commands (thanks to forum user Sanjay Sheth for compiling this):
All messages in the mailbox; the default initial key for ANDing.
Messages with the \Answered flag set.
Messages that contain the specified string in the envelope structure's BCC field.
Messages whose internal date is earlier than the specified date.
Messages that contain the specified string in the body of the message.
Messages that contain the specified string in the envelope structure's CC field.
Messages with the \Deleted flag set.
Messages with the \Draft flag set.
Messages with the \Flagged flag set.
Messages that contain the specified string in the envelope structure's FROM field.
Use the fuzzy-match (high speed index) search engine for the next search key (e.g. "FUZZY BODY xyz".)
HEADER <field-name> <string>
Messages that have a header with the specified field-name and that contains the specified string in the field-body.
Messages with the specified keyword set.
Messages with an size larger than the specified number of octets.
Messages that have the \Recent flag set but not the \Seen flag. This is functionally equivalent to "(RECENT UNSEEN)".
Messages that do not match the specified search key. Eg: NOT BODY "cat"
Messages that do not have the \Recent flag set. This is functionally equivalent to "NOT RECENT" (as opposed to "NOT NEW").
Messages whose internal date is within the specified date.
OR <search-key1> <search-key2>
Messages that match either search key. Eg: OR BODY "cat" BODY "dog"
Messages that have the \Recent flag set.
Messages that have the \Seen flag set.
Messages whose Date: header is earlier than the specified date.
Messages whose Date: header is within the specified date.
Messages whose Date: header is within or later than the specified date.
Messages whose internal date is within or later than the specified date.
Messages with an size smaller than the specified number of octets.
Messages that contain the specified string in the envelope structure's SUBJECT field.
Messages that contain the specified string in the header or body of the message.
Messages that contain the specified string in the envelope structure's TO field.
UID <message set>
Messages with unique identifiers corresponding to the specified unique identifier set.
Messages that do not have the \Answered flag set.
Messages that do not have the \Deleted flag set.
Messages that do not have the \Draft flag set.
Messages that do not have the \Flagged flag set.
Messages that do not have the specified keyword set.
Messages that do not have the \Seen flag set.