Solve Mail search problems

27.10.2011

On the other hand, suppose you stick with the Entire Message option to look for words in the contents of message bodies, because you aren't sure who sent the message or when, or because the number of matches using headers alone is too great. Searching for unusual, specific keywords you remember from the message ("furlong," "fortnight") or entire phrases ("lost in the mists of time") can often lead you right to the message you want--unless full-text searching happens to be broken.

Mail uses OS X's Spotlight feature to index and search the contents of messages, so if you have trouble with searching message contents, the most likely cause is a problem with your Spotlight index. Try the following potential cures, in this order, retrying your search after each until you're successful:

Open the Spotlight pane of System Preferences, go to the Privacy tab, and make sure it doesn't show your ~/Library/Mail folder or any of its parent folders (such as your entire home folder) or the volume on which it's located. If it does, select that folder or volume and click the minus (-) button to allow Spotlight to index it (which may take some time).

For server-based accounts (IMAP, Exchange, iCloud, and MobileMe), make sure Mail is set to download entire messages--if it doesn't, Spotlight can't index them. Go to Mail -> Preferences, click Accounts, select an account, and click Advanced. Make sure the Keep Copies Of Messages For Offline Viewing pop-up menu says All Messages And Their Attachments.

Open Terminal (in /Applications/Utilities) and type this command, followed by Return: mdimport -r /System/Library/Spotlight/Mail.mdimporter This causes Spotlight to re-index all your Mail messages, leaving the rest of your Spotlight indexes (for other types of data) intact.