Back to Hermes Agent

Gmail Search Syntax

skills/productivity/google-workspace/references/gmail-search-syntax.md

2026.6.52.1 KB
Original Source

Gmail Search Syntax

Standard Gmail search operators work in the query argument.

Common Operators

OperatorExampleDescription
is:unreadis:unreadUnread messages
is:starredis:starredStarred messages
is:importantis:importantImportant messages
in:inboxin:inboxInbox only
in:sentin:sentSent folder
in:draftsin:draftsDrafts
in:trashin:trashTrash
in:anywherein:anywhereAll mail including spam/trash
from:from:[email protected]Sender
to:to:[email protected]Recipient
cc:cc:[email protected]CC recipient
subject:subject:invoiceSubject contains
label:label:workHas label
has:attachmenthas:attachmentHas attachments
filename:filename:pdfAttachment filename/type
larger:larger:5MLarger than size
smaller:smaller:1MSmaller than size

Date Operators

OperatorExampleDescription
newer_than:newer_than:7dWithin last N days (d), months (m), years (y)
older_than:older_than:30dOlder than N days/months/years
after:after:2026/02/01After date (YYYY/MM/DD)
before:before:2026/03/01Before date

Combining

SyntaxExampleDescription
spacefrom:alice subject:meetingAND (implicit)
ORfrom:alice OR from:bobOR
--from:noreply@NOT (exclude)
()(from:alice OR from:bob) subject:meetingGrouping
"""exact phrase"Exact phrase match

Common Patterns

# Unread emails from the last day
is:unread newer_than:1d

# Emails with PDF attachments from a specific sender
from:[email protected] has:attachment filename:pdf

# Important unread emails (not promotions/social)
is:unread -category:promotions -category:social

# Emails in a thread about a topic
subject:"Q4 budget" newer_than:30d

# Large attachments to clean up
has:attachment larger:10M older_than:90d