How To Search Content Within Gmail

Gmail search interfaceGmail is one of the most popular email services used by millions of people around the world. It's very flexible and offers tons of features when it comes to customizing the entire experience. Users getting tons of emails often search archives to find out the exact attachment or text they're looking for. Sometimes, they succeed in their search and sometimes they couldn't find the email they're looking for. Fortunately, Gmail includes extremely powerful and flexible search operators that can be used to perform complex search queries on your email archive. These advanced search operators let you find a pin in a haystack. Mastering Gmail search is not hard at all and all you need is few dummy search queries to practice all the available operators. Once you get familiar with the commands, you can retrieve select content from your Gmail account very easily.

Find All Mails 'Sent To' or 'Received From'

We'll start with the basics and will address the most common queries used by Gmail users. Users often want to find all emails sent to a particular contact or received from a specific email address. You can easily filter out these emails through the following commands.

#Find all emails received from matt.johnson

#Find all emails sent to cynthia.berry

#Find all emails sent either to k.gross or received from p.lee
to:k.gross OR from:p.lee

As you can see from the commands shown above, the usage is pretty simple. Pay attention to the 'OR' operator used in the last command to combine two search parameters in a single query. This way, you can combine multiple parameters to perform a more complex query.

Find Specific Words & Phrases in the Subject Line

This is yet another popular query used by lot of users who want to search emails containing select words or phrases in the subject line. You can perform this search in 3 different ways depending on your requirements. For example, you may want to find a single word, two words on different locations or a phrase in the subject line. Here are the commands to do that.

#Find emails containing word 'hosting' in the subject line

#Find emails containing words 'hi' or 'money' in the subject line
subject:hi OR subject:money

#Find emails containing phrase "Hosting details" in the subject line
subject:"Hosting details"

No matter what query you're performing, usage of these operators help you perform a single query with multiple conditions. Pay attention to the second query given above where both the words may be present at different locations in the entire subject line.

Filtering or Excluding Information

At times, you may want to search a specific piece of information but also want to include selective content where another piece of content is associated with the primary content you're looking for. For example, you're looking for emails containing 'hosting' keyword in the subject line but also want to exclude or filter out those email that also contains word 'discount' in the same subject line. Here's how you can do it.

#Find 'hosting' but filter out 'discount' from search results
subject:hosting -subject:discount

Notice the '-' hyphen symbol prefixed at the second subject parameter. It is used as a NOT operator whenever you want to exclude some of the information from the search results. You can combine this operator to fine tune your complex query to get the filtered results.

Find Emails with Specific Labels

Labels in Gmail can be compared with folders found in other email services. They're perfect for organizing your archive to group similar kind of conversations in a single group. Gmail search lets you use the 'label' operator to find emails associated with a specific label.

#Find all emails with label 'personal' and received from mary.kites
label:personal from:mary.kites

If you've created a lot of labels and frequently assign these labels to your daily emails, this operator can help you find the exact content very easily. You can combine this operator with others to further refine your search for finding a particular email within a single or more than one label.

Find Emails With or Without Any Attachments

Attachment is an integral part of the modern day email communication. It's used more frequently while doing business communication. We often want to search emails with attachments sent by a particular person. You can do so very easily with the attachment operator.

#Find all emails from joe.sanders with attachments
from:joe.sanders has:attachment

#Find all emails from sara.jones without any attachment
from:sara.jones -has:attachment

Both the examples given above show you usage of 'has' operator with 'attachment' as a parameter. You can see, how hyphen operator in the second example filters out emails containing no attachments. As I've said before, you can use multiple operators in different ways to create a powerful query.

Find Emails with Specific Type of Attachments

The 'attachment' parameter discussed above simply filters out emails having attachment and is generic in nature. Suppose if you want to find an email containing file 'sample.txt' as an attachment or if you want to find all emails from a contact that only contains JPG image files as attachments. You can do so easily through the following commands.

#Find all emails having file 'sample.txt' as attachment

#Find all emails received from amanda.lee having JPG images as attachment
from:amanda.lee filename:jpg

This operator is very powerful and supports several popular file formats like JPG, DOC, XLS, PPT, and PDF. If you know the entire file name of the attachment, you can use that too as shown in the first example. Web developers, freelancers, and designers use this operator frequently, as they often deal with attachments in their daily email.

Use Multiple Parameters with a Single Operator

So far, we've seen different operators that can be used to search content in Gmail. But each of the examples given above contains one parameter with each operator. At times, we want to supply multiple parameters to a single operator to broaden the scope of our query. For example, if you want to search for emails containing either PDF or DOC files as attachments, you can use the following query.

#Find emails containing both PDF or DOC files as attachment
filename:{doc OR pdf}

The curly braces combine multiple parameters within a single operator. This gives more power to you making the query more flexible and user-friendly. You can use curly braces with all the supported operators. The example is shown above simply shows two parameters, but you can specify more than two parameters using multiple Boolean operators.

Limit Search within Specific Folder/s

Every email service includes standard folders like inbox, spam, and trash. Gmail also has about half a dozen standard folders where emails are organized for better navigation and accessibility. Now you can limit the scope of your search to a specific folder through a special operator. For example, if you want to find all deleted emails received from a specific contact and are now in the trash folder, you can do that easily through the following command.

#Find all deleted emails in trash received from bill.winkins

in:trash from:bill.winkins

#Find emails sent to john.garrett present anywhere in any of the standard folders
in:anywhere to:john.garrett

The 'in' operator is used to tell Gmail about the location where search needs to be done for the relevant emails. This operator recognizes all standard folders like inbox, all, spam and trash. You can also use 'anywhere' parameter to broaden your search to all the standard folders.

Search Emails with Different States

A typical email can be in a read, unread or starred state. We often want to limit our search based on the state of the email. For example, you may want to find all unread emails received from a specific content and that too which are not starred by you. Here's how you can do that.

#Find unread emails from molly.baxter which are not starred by you
from:molly.baxter is:unread -is:starred

#Find all chats containing the word 'crossword' in it
is:chat crossword

Both the examples shown above give you a glimpse of the flexibility and power of Gmail search. You can see how you can search chat archives too which is a very handy option in different situations. You can use curly braces to search for multiple words in chat to further refine your search. I frequently use 'is' operator for finding specific starred emails.

Tame CC & BCC Search

Email carbon copies and blind carbon copies are life and blood of this communication medium. We often send CC & BCC emails to multiple recipients. You can use both these operators for finding these recipients very easily. Here are some of the examples.

#Find all emails BCC-ed to

#Find all emails CC-ed to priscilla or kevin.moore
cc:{priscilla OR kevin.moore}

Remember, you cannot search for those emails in which you were specified as BCC-ed recipient. Both these operators are extremely useful when you're dealing with large number of recipients who're receiving a generic email. I often use it to segregate emails on the basis of recipients.

Search Emails Based On Dates & Time Frames

This is yet another powerful feature of Gmail search that lets you filter out content on the basis of dates. You can either create an open-ended date search or you can create a time-frame based search. For example, you can search for emails sent before or after a specific date or you can search for emails sent between specific time periods.

#Finds all emails sent between 21st November, 2008 to 16th June, 2009
after:2008/11/21 before:2009/06/16

#Find all emails sent to mathew.haydon before 23rd January, 2010
to:mathew.haydon before:2010/01/23

As you can see from both the examples, date-based queries are quite useful in filtering out content from a specific period. You must supply these dates in yyyy/mm/dd format. Notice the zero prefixed in front of a single digit month. There's no need to prefix this zero when using for months from October onwards as they're already two digit months.

Find Emails from People in Your Google+ Circles

Now that Google+ is used by millions of Gmail users across the globe, you may want to search for email communications from a specific Google+ user. Fortunately, we have a special operator to find emails from a user who is in a specific circle created by you.

#Find all emails from users in Google+ circle 'Probloggers'

#Find emails from users in Google+ circle "Soccer players"
circle:"Soccer players"

Note the use of double quotes for circle names containing more than one word. If you frequently exchange emails with Google+ users, this operator is a boon for you. Since Google+ has been tightly integrated with Gmail, you can keep track of email conversations of select Google+ users through this operator.