Gmail Search Operators for Building a Contact List

8apps Team·

A working reference for the Gmail search operators that define a contact list: labels, senders, dates, categories and attachments - plus the combinations that actually scope an export.

Most guides to Gmail search operators are written for finding one email. This one is written for the opposite job: defining a set of messages precisely enough that the addresses inside it are worth collecting.

That changes which operators matter. is:starred is excellent for finding a thing you starred. It is nearly useless for defining a list, because you starred those messages for unrelated reasons.


The operators that define a set

These five do almost all the work.

label: — the strongest signal you have

label:clients
label:conference-2026

A label is a decision you already made about which messages belong together. If you have been labelling consistently, this single operator does more than the other four combined.

Multi-word labels need quotes: label:"Q3 pipeline". Nested labels use a dash: label:clients-enterprise.

from: and to: — including whole domains

from:jane@acme.com
from:@acme.com
to:sales@yourcompany.com

The domain form is the useful one. from:@acme.com maps everyone at a company who has written to you — which is often the actual question behind "who are our contacts at Acme?"

newer_than: / older_than: — relative windows

newer_than:6m
older_than:2y

Units are d, m, y. These are relative to today, which is what makes them the right choice for a recurring export: newer_than:6m still means "the last six months" a year from now.

after: / before: — fixed windows

after:2026/01/01 before:2026/04/01

Use these when the window is a real boundary — a quarter, an event, a campaign — rather than a rolling period.

category: — Gmail's own sorting

category:primary
category:promotions

Options are primary, social, promotions, updates and forums. category:primary is a blunt but surprisingly effective way to strip newsletters and automated mail out of a broad search.


Supporting operators

OperatorMatchesNote
subject:Words in the subject line onlyA bare keyword searches subject and body
has:attachmentMessages with any attachmentGood proxy for substantive threads
filename:pdfAttachments by name or extensionfilename:resume for recruiting
cc:me / bcc:meMessages you were copied onFinds threads you were looped into
larger:1M / smaller:10kMessage sizeLarge messages usually mean real documents
is:unread / is:readRead stateRarely useful for list-building
in:anywhereIncludes Spam and TrashAlmost always the wrong choice here

Combining them

Operators are ANDed by default. Space-separated terms all have to match:

label:clients newer_than:6m has:attachment

OR (capitals) and parentheses give you alternatives:

(from:@acme.com OR from:@globex.com) newer_than:1y

A leading - excludes:

label:inbox newer_than:3m -category:promotions -from:@yourcompany.com

That last one — excluding your own domain — is worth building into every query you write. Without it, a large share of any contact export is your own colleagues.


Four queries that produce usable lists

Everyone at a company you have dealt with this year

from:@acme.com OR to:@acme.com newer_than:1y

People who replied to a campaign or announcement

to:announce@yourcompany.com newer_than:3m -from:@yourcompany.com

Candidates who sent a CV

has:attachment filename:resume newer_than:6m

Active client threads, excluding automated mail

label:clients newer_than:6m category:primary -from:noreply

Testing before you export

Run the query in Gmail and read the result count.

This is the step that separates a list from a mess. If the count is in the thousands, the query is too loose — add a newer_than:, a label:, or an exclusion until the number resembles something you would actually work through. If it is zero, check for a mistyped label; Gmail fails silently on labels that do not exist.

Scroll the first page of results too. If the messages surprise you, the query is describing something other than what you meant.


Turning the query into a list of addresses

Gmail will show you the messages. It will not give you the addresses inside them — there is no export button for that, and Google Takeout returns an .mbox archive rather than a list. (The full comparison is here.)

Contact Extractor takes the query you just tested and writes the email addresses - and the names attached to them - into a Google Sheet, deduplicated. The filters map directly onto the operators above — Gmail label, From, To, Subject, after/before dates, with the rest available under Advanced Options — and a Verify button opens the assembled query back in Gmail so you can confirm the scope matches what you tested.

You also choose which fields to read from: To, From, CC, BCC, Reply-to, subject line or message body. Operators define which messages; the field selection defines which contacts within them. Both matter.


Related reading