Mail search not finding messages but Spotlight does

When I search for a particular message in Mail.app, using the search field, even when I have the message in sight, Mail cannot find it. But, frustratingly, when I use Spotlight, it is able to find the message.

For example, I'll open a folder with a variety of recipes. I can see all the subjects and I see an email with the subject: "Smoothies". Typing in "Smoothies" into the search field brings up 0 results. But typing in "Smoothies" into Spotlight shows the desired message.

How can I get Mail.app to search correctly?

I'm running Mac OS X 10.11.3.


Solution 1:

Rebuilding Mail.app's mailboxes fixed this for me. This ComputerWorld article is a great reference for rebuilding and reindexing your mailboxes:

  • Rebuild: Select a mailbox (or several by shift-clicking) and then use "Mailbox > Rebuild"
  • Reindex: Quit Mail, navigate to ~/Library/Mail/V2/MailData (on Mac OS 10.12 - Sierra, ~/Library/Mail/V4/MailData) and delete any files where the name begins with Envelope Index. Mail will rebuild the indexes on the next start (which may take a long time depending on the size of your mailboxes)

Solution 2:

This helped me - it allows unrestricted spotlight search - and, after executing that command, mail search and smart mailboxes worked again

Open terminal from the utilities folder and execute:

sudo defaults write /Library/Preferences/com.apple.security.appsandbox \
    UnrestrictSpotlightContainerScope -bool true

Solution 3:

for years I had this problem (on and off) and tried everything I could find. Finally I found this: for some reason indexing was turned off and I had to 'switch it on' with sudo mdutil -a -i on After that mail search immediately worked. Hope this will make a few people less frustrated with mail (like I was)

Solution 4:

I just migrated my email from 10.13 tot 10.14 to find out i had this problem as well. The only solution that worked for me was nr 4

sudo defaults write /Library/Preferences/com.apple.security.appsandbox \
    UnrestrictSpotlightContainerScope -bool true

problem is since some only need this one item and others need more steps, perhaps there are multiple problems to be solved with the same end symptom.

Letting security relax Container Scope is quite vague and not documented, but it worked for me.