AgentLoops
Gmail

Search Email

Search for emails in Gmail using various criteria.

Search Email

This node allows you to search for emails in Gmail. You can filter by sender, recipient, subject, content, and date. It supports fetching full thread details and marking messages as read upon retrieval.

Inputs

VariableTypeRequiredDescription
credentialIdCredentialYesThe Gmail credential to use for the search.
fromstringNoFilter by the sender's email address.
tostringNoFilter by the recipient's email address.
subjectstringNoFilter by email subject.
contentQuerystringNoSearch for text within the email content.
dateRangestringNoFilter emails by date range. Options: "all" (any time), "1d" (past 24 hours), "7d" (past week), "1m" (past month), "1y" (past year), or "custom" (specify custom date range).
customDateFromstringNoStart date for custom date range (YYYY-MM-DD format). Only used when dateRange is "custom".
customDateTostringNoEnd date for custom date range (YYYY-MM-DD format). Only used when dateRange is "custom".
maxResultsnumberNoThe maximum number of results to return. Default: 10.
includeReadbooleanNoWhether to include messages that have already been read.
markAsReadbooleanNoAutomatically mark found messages as read.
getFullThreadbooleanNoFetch the full conversation thread for each message.

Date Range Examples

Preset Ranges

Use preset date ranges for common time periods:

  • Past 24 hours: Set dateRange to "1d"
  • Past week: Set dateRange to "7d"
  • Past month: Set dateRange to "1m"
  • Past year: Set dateRange to "1y"
  • Any time: Set dateRange to "all" or leave it unset

Custom Date Ranges

For more precise date filtering, use custom date ranges:

  1. Specific date range (e.g., January 1-15, 2024):

    • Set dateRange to "custom"
    • Set customDateFrom to "2024-01-01"
    • Set customDateTo to "2024-01-15"
  2. All emails after a specific date (e.g., after March 1, 2024):

    • Set dateRange to "custom"
    • Set customDateFrom to "2024-03-01"
    • Leave customDateTo empty
  3. All emails before a specific date (e.g., before December 31, 2023):

    • Set dateRange to "custom"
    • Set customDateTo to "2023-12-31"
    • Leave customDateFrom empty

On this page