Alright, Dave, you’ve convinced me to sign up and use Google’s Gmail Service and I now have an ever-growing pile of archived messages. I know that I can just type in a word or two to the search engine and find messages, but being Google, I’m wondering if there are more sophisticated searches I can use?
Glad you’re enjoying Gmail! If anyone wants an invite to get a Gmail account of their own, please read my article on how to get a Gmail account.
I did some digging around and was rather pleased to find out that the Gmail search system has lots and lots of what we search engine folk call predicates, specific tags you can apply to a word so that it matches a specific type of data. It’s like the powerful site: predicate in the regular Google search system (and you know about that, right?)
The easiest search predicates to learn for Gmail are from:, to: and subject:. For example, want to find a message from me? Look for from:taylor in your Gmail archive. Want to find all messages from me that mention blogging? Try from:taylor subject:blog.
You can also use some of the standard Google search modifiers too. Add an OR (must be capitalized!) and you’ll change the logic of your search, allowing you to search for all messages from me or my buddy Dan: from:taylor OR from:dan. Additionally a “-” excludes matches, so a search for messages from me that aren’t about blogging could be from:taylor -blogging
You can also search for a specific label with label:, search for messages that have attachment with has:attachment (which means that -has:attachment will match messages that don’t have attachments, of course), and you can look for the message or messages that have a specified file as an attachment with filename:.
Here’s a cool one to know too: messages that are in your Spam or Trash folders won’t automatically match your searches, but you can add them to the search pool with in:anywhere or, if you must, specify an exact location with in:inbox, in:trash, or in:spam.
If you can search the to: it should be no surprise that you can also search cc and bcc:, though the latter is of limited use because you should never receive a message with an explicitly Bcc list, as that’d defeat the purpose of a “blind” carbon copy.
Finally, you can also constrain your searches by date. Use before: or after: with dates in the format “yyyy/mm/dd” format. To search for messages I sent you that had JPG attachments prior to Feb 14, 2005, for example, you could use:
in:anywhere from:taylor filename:JPG before:2005/02/14
As always, the Google tool is very nice and very powerful.