Gmail Search Syntax
Gmail offers a rich search syntax for routing through your email message archive—as if you’d expect, or indeed stand for, any less.
-
from
: Digs through the headers of your email message archive in search of mail sent by someone matching the keyword that you provide.
from:rael@oreilly.com
-
to
: The yang to
from
:’s yin,to
: finds all messages sent to someone matching a provided keyword. (Don’t forget plus-addressing Hack #72 .)to:engineers@example.com to:raelity+shopping@gmail.com
-
subject
: Matches messages with a particular subject.
subject:"meeting notes"
-
label
: Looks for messages with a particular label applied.
label:knitting
-
has:attachment
The
has
: syntax has only one possible value (at least at the time of this writing):attachment
.has:attachment
in a query returns only messages having one or more attachments.has:attachment
-
filename
: Finds messages with an attachment filename matching a provided pattern. Used with just a file extension (e.g.,
pdf
ortxt
),filename
: turns up all messages with attachments of a particular type.filename:meeting_notes.txt filename:pdf
-
in
: Returns a list of messages in a particular collection (read: folder). Acceptable values for
in
: areinbox
,trash
,spam
, andanywhere
(trash and spam are not included in searches unless explicitly included usingin:trash
,in:spam
, orin:anywhere
). Oddly enough,sent
isn’t a usable value forin
:.in:inbox in:anywhere
-
is
: Acceptable values for
is
: arestarred
,unread
, andread
, which return starred, unread, ...
Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.