Skip to content

An alternative way to search Mail for senders and content

For better or worse—most might argue "worse"—I rely on the built-in macOS email client, annoyingly named Mail. (Why annoying? Try searching the web for help when you're having trouble with "Mail"…) I've tried nearly every third party replacement, but something (usually in the UI) always brings me back to Mail.

In any event, I have a huge database of messages that I've built up over the years, especially since starting at Many Tricks with Peter Maurer back in 2010. Often I want to find a message that's both from a particular person, and contains certain words. For example, I want to find all emails from Peter that contain the word "pricing."

The "correct" way to do this in Mail is to type From: in the search box, then start typing the name you want to match. As you type, a list of possible matches appears below the search box. Use the arrow keys (or reach for the mou…no, don't do that) to move down and select the right name from the list of matches, then press Return.

When you press Return with the desired name highlighted, the From: text in the search field turns into a token with the selected user's name, as seen at right. You can then continue typing the rest of your search terms; pricing in this case. Press Return again, and the search runs and returns the matches (17 messages in my example).

While this works fine, it's annoying and time consuming to interrupt the flow of typing a search by visually scanning a box, moving a selection, pressing Return, then starting to type again. So I thought I'd try the logical alternative—I just typed in my search query: from:peter maurer pricing. But this returned no matches.

On a lark, I tried reversing the order: pricing from:peter maurer.

Bingo! This works as expected, showing only messages from Peter that contain the word pricing. (Oddly, it finds two more matches than does the official method, and I cannot figure out why those messages are excluded from the other method's matches.)

I have no idea why this works—if it were just grabbing the "maurer" bit from email messages' headers or content, then the order of the terms wouldn't matter. But the order does matter, which implies that it's really looking for the full name in the From field. In any event, I'm glad that I can search without pausing to scan-and-choose a name from a list.

And because movies are fun, here's a little clip showing one method failing while the other one works.

If you do the same sort of searches in Mail, and want to avoid the 'select name from list' step, just remember to put the from: bit at the end of your search, and it should work as you expect.

3 thoughts on “An alternative way to search Mail for senders and content”

  1. I’m wondering what the scope of the from: qualifier is - how about searching “pricing maurer from:peter”?

    1. Ah, good thought ... and yes, that returns the same 19 matches (still two more than the official method). Does that say, then, that anything before "from" is searched in both header and body? I guess so, because that's the only spot 'maurer' appears in most of those emails.

      Strange, but good to know!

      -rob.

Comments are closed.