How to search your mail

To find a message, simply type one or more keywords into the "Search mail" box in the mail toolbar and hit enter. By default, all folders except Spam and Trash will be searched. If you are currently in the Spam or Trash folder, then just that folder will be searched instead.

If you're having trouble finding what you're looking for, you can create a more precise search using our advanced search builder:

  1. Focus the search bar at the top of the page.
  2. Select the "Advanced search…" option from the menu that appears.

This allows you to look for the keywords in specific places (for example the To or Subject fields), set the date range you want to search and specify whether the email must be unread or pinned, or have a particular type of attachment.

Saving searches

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 for quick reuse.

Search syntax

You can build detailed searches directly in the mail search box, using a special syntax of keywords, boolean flags and operators to combine multiple options together.

Searching particular folders

By default, all folders will be searched except Spam and Trash. You can include these folders as well by adding in:* to your search. You can also use the in keyword to restrict your search to specific folders, e.g. in:Inbox OR in:Drafts. To specify a subfolder when using the in keyword, use a . to separate the subfolder's name from the parent folder, e.g. in:"Mailing Lists.Hiking".

Searching for text

Phrases are matched on a complete basis with stemming (all different forms of the same word are treated as equivalent). This means, for example, a search for bus will match "buses" but not "business".

If you want to search for a phrase with spaces in it, use quotes for the phrase part (either ' or ", but matched), e.g. from:"Joe Bloggs" or subject:'string with "double" quotes', but not from:Joe Bloggs or subject:"must end with same'. You can also use \", \' and \\ to match a literal ", ' and \ respectively in a phrase.

When searching for a phrase in a specific header, you must put a space between the header name and the phrase. Therefore, the term must be wrapped in a quote, e.g. header:"X-spam-hits: WEIRD_PORT".

Using substr to wrap other search terms changes their behaviour. Instead of matching stemmed whole words, search terms will be matched on a straightforward "contains" basis. This means that even partial words or parts within words will match. For example, substr:(from:ber) will match an email from "Robert", because "ber" is contained in "Robert". Please note that searching for substrings will be significantly slower than regular searches.

Searching by date

A date can be either absolute (e.g. date:"30 sep 2010") or relative (e.g. date:"2 weeks ago"). Most forms of writing a date are accepted. It also supports integers with units, d (day), w (week), m (month) or y (year). So date:2w is equivalent to date:"2 weeks ago".

Searching by message size

A size is a number specified in bytes, with an optional suffix k, m, or g, e.g. larger:10m.

Searching by message state

The following boolean states can be specified with the has or is keyword:

For backwards compatibility, we also support writing a boolean term in UPPERCASE without the has or in keyword prefix. For example, the searches UNSEEN HASATT or is:unread has:attachment are equivalent, and will both show all unread messages with attachments.

The filetype keyword finds emails with attachments of the given type. It does this by looking at the MIME type of the attachments. Some systems may generate emails with attachments with the wrong or "missing" MIME types, in which case the search may unfortunately fail to find the expected emails.

Searching for a specific ID, and raw IMAP search

If you know the message id you are searching for, you can use the msgid keyword to find it directly.

A value in imap:"…" is passed directly to the IMAP server. See the IMAP specification for full details.

The IMAP search syntax is arcane and difficult to use, and pretty much everything can be done using the much easier standard syntax described above.

Operators

Operators must always be uppercase.