If there is one thing that frustrates me about Apple's Mail client it is the poor searching. Apple Mail isn't nearly as powerful as it could be, but for many it may be enough — if you know some of the shortcuts and commands.
There is an empty search box in the upper right-hand corner of the Mail window and it is here that you type in your search terms. But what do you type? Having done some poking around, it seems that Apple neglected to document any of the possible commands that can be used here. By the looks of things, you simply type in the field and then manipulate the search results page to select if you want to search the To or From fields, etc.
It can be done easier, if you know a few of the commands. This will save some mousing around and will help you construct more useful search terms.
There are five search "terms" or "expressions" that can be used. Using just text, such as "john", will search for "john" everywhere: To, From, Subject, and the Entire Message (or whichever field you click on later to tune where you want to search). If you are looking for email from John, you can use "from:john" and Mail will search for emails that contain "john" in the email address or the name. Using the "from:" predicate is the second term, the others are just as obvious: "to:" to search in the To: address, "subject:" to search subject lines, and "email:" which looks to search any email address (From or To, giving higher rank to matches in the From address).
You can also combine these to create better search filters. It's a little clumsy, but it's not entirely useless. For instance, if you want to find all messages from you (email@example.com) to your wife (firstname.lastname@example.org) you might use:
Now assume you want to find messages from you, to your wife, about an upcoming vacation. Buried somewhere in your mailbox you vaguely remember that such emails had the word "vacation" in the subject, however you don't want to just pull up any old message with "vacation" in the subject (such as spam or conversations with other people):
from:you to:wife subject:vacation
There also seems to be a NOT conditional, but not an OR conditional; the NOT conditional is fairly messed up and doesn't seem to work reliably. I would not trust using anything like NOT or OR (AND is implied when you have more than one word in the search). You may decide to play, and perhaps you'll have better luck than me, but Mail's searching is extremely basic, simple, and using conditionals seems to really confuse it. Using Smart Folders gives you far more options than the search box, sadly, but who wants to define a Smart Folder for the occasional targeted search query?
There are other tools that can enhance Mail's poor search implementation. One such tool is Rocketbox but it didn't impress me very much. Maybe I didn't give it enough time to index all the mail, but when it didn't tell me it was still indexing, and I tried to search, the results I got were less accurate than Apple Mail's.
Another application is HoudahSpot, which is a better frontend to Spotlight than Spotlight. It uses all of Spotlight's metadata but gives you much more powerful ways of searching. While HoudahSpot searches more than just Mail, it can be used to build more complex search queries than what is afforded by Mail. HoudahSpot's steep $30 price tag may prevent you from looking at it, unless you are also looking for a more advanced search tool than Spotlight itself, and you find it fills that need.
It's quite depressing that after all of this time, Mail still cannot do more than dumb queries. While full regular expression support would be nice, I would be happy with a working NOT conditional and an available OR conditional.
As it stands now, it makes me want to drop into a Terminal and grep around in ~/Library/Mail/. Come on Apple, it's 2011. Email searching has been figured out over a decade ago. It's amazing that they lead the pack in so many areas but completely drop the ball on something as simple as this.
Perhaps someone out there would be kind enough to offer a better searching solution (besides an alternate mail client, of course)?
Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.