Email providers such as Gmail and iCloud make it easy to store your old messages by the thousands, but finding one of those messages in your desktop email program is sometimes tricky. The Lion version of Apple Mail includes useful new search features, but also adds complexity and confusion to the process of finding messages. You can locate the messages you want, quickly and easily, by following some simple steps and learning a few pro tricks.
The easiest way to find something is to type one or more words in the Search box and see what shows up in the message list--you need not even press Return. By default, Mail looks for whatever you typed in the contents of all your messages. However, you can narrow down your searches in several ways.
Suggestions, tokens, and scope
The first thing you may notice is that as you type in the Search field, Mail displays a list of suggestions--things it guesses you might be searching for. You're free to ignore these, but if you see what you're searching for in this list, you can select it (with your mouse, or by pressing the arrow keys followed by Return) to quickly narrow the search.
Let Mail help For example, if you type a portion of someone's name or email address, Mail may display the full name under a "People" heading. Select that name and Mail encapsulates it in a blue bubble it calls a search token, which enables you to read it or change its attributes more easily and with fewer errors than using old-fashioned search terms such as from:[email protected] Similarly, if you type something resembling a date (such as October 2011 or yesterday,), Mail offers to create a token that matches messages from that date.
By default, tokens match your search term in message headers or metadata, such as To, From, Subject, Date, Status (for example, unread or flagged), Attachments, or a mailbox name--whichever seems the most likely match. If you want to search in a different location, click the arrow next to the token's category and choose a different one from the pop-up menu. For example, if you select a person and the token says From:Dan Frakes, you can click From and change it to To. One of the options on this menu is always Entire Message, which expands the search to include the contents of messages, in addition to their headers and metadata.
Narrow your search Your search isn't limited to just one token. If you use two or more in combination, Mail looks for messages that match all of them--for example: messages from a single sender about a particular topic (From:John Smith Subject:Curling); messages in a date range with some attribute (Date:January 2006 Status:Flagged); or unread messages with attachments containing a certain word (Status:Unread Attach.:grapefruit). Your search can also include plain text in addition to one or more tokens, allowing you to search for things like From:Dan Frakes, Date:Last Week, Subject:Mac gems, and utility all at once. If you change your mind about a part of your search, select it and press Delete.
Choose where to search In addition to determining which part(s) of a message to search, you can determine which mailbox(es) to search. As soon as you begin typing your search term, Mail displays additional options on the left of the Favorites bar (below the toolbar), which contains shortcuts to frequently accessed mailboxes.
The first option is All, meaning all mailboxes, in all accounts; that's followed by either the name of the currently selected mailbox, if any, or Selected Mailboxes, if more than one mailbox is selected. So, to specify which mailboxes Mail should search, click All or one of the other options in the Favorites bar.
Be aware of Mail's logic The suggestions Mail offers for creating search tokens depends on the search scope you choose. For example, if you're searching for a person's name, but your search currently includes only your Inbox and you don't happen to have any email from that person in your Inbox, the name won't be suggested as a token. But if you click All, suddenly Mail has a broader scope in which to search for the person's name, and it's much more likely to show up as a suggestion.
Mail tries to be clever when matching names. If I use From:Dan Frakes as my search token and my Address Book or Previous Recipients List has more than one address for Dan (say, a work and home address), Mail displays matches from any of those addresses. In fact, that's true even if I expressly search for [email protected] of the fact that the search token shows a specific address, Mail actually returns messages from any of Dan's addresses! (This may or may not be the behavior you want, but to avoid frustration, it's best to be aware of how Mail works.)
Advanced search tips
Although simple searches can get you pretty far, you can perform more sophisticated searches if you know a few tips:
Take advantage of defaults If you choose All as the scope for a search, Mail defaults to All next time too. If you search in a single mailbox, Mail defaults to searching the selected mailbox next time.
Put phrases in quotes To search for a phrase, put it in quotation marks. A search for "apple pie" will find that entire phrase, but not messages with just "apple" or "pie" independently.
Adjust search terms according to scope When you search in headers (To, From, Subject, Date), Mail matches the strings you type anywhere in a word. For example, a search for cat matches "bobcat" as well as "catch." However, when you search message contents using the Entire Message option, Mail matches only the beginnings of words--cat matches "catch" but not "scat." This applies to multiple words, too: In a header, press ring will match a message whose subject is "exploring impressionism" whereas a search of message contents would only match if the message contains words beginning with both "press" and "ring."
Try Boolean searches for message contents The Lion version of Mail now supports Boolean searches for message contents (though not for headers). You can use the terms AND, OR, and NOT, along with parentheses, to search for combinations of terms within a message body. For example, if the Search field says pineapple AND (peppers OR broccoli), Mail returns messages that contain the word "pineapple" along with either the word "peppers" or "broccoli" (or both)--omitting messages with "pineapple" but not one of the other words. Be sure to put the words AND, OR, and NOT in all caps so they're not treated as ordinary words; you can use a hyphen (-), with no following space, as a shortcut for NOT, as in pineapple -eggs.
Specify date ranges You can search for messages from a range of dates as long as you enter the dates in the form "M/D/Y-M/D/Y" (as in 3/28/11-4/14/11). Ranges don't create tokens, however, which means you must enter them carefully; a small typo can throw off everything.
You can't search invisible headers Whether you search in headers or Entire Message, you can't search headers that are ordinarily invisible (such as Content-Type, Message-ID, or Return-Path). That's inconvenient when you want to look for messages sent by a certain email program, that have been processed by a server-based spam filter, or that have other special attributes that aren't part of the message headers and body.
Save a search as a Smart Mailbox You can click the Save button below the Search field to save any search as a Smart Mailbox (Mailbox -> New Smart Mailbox), which then appears in Mail's sidebar. This is a good idea when you have a search you perform frequently, especially if it's a complex one. Smart mailboxes are updated dynamically as messages are added, deleted, and moved. To edit a smart mailbox, double-click it; you can modify it just as you would a Mail rule. (See "Use Mail's smarts" for more information.)
Senior contributor Joe Kissell is the senior editor of TidBits and the author of the e-book Take Control of Mail on the iPad, iPhone, and iPod touch, Second Edition.