Get Gmail Emails
You can select this activity to retrieve emails from a Gmail mailbox through the filtering and pagination options.
This table lists the properties for the activity.
| Property Type | Property Name | Data Type | Description |
|---|---|---|---|
| Options | Filter | InArgument<String> | The criteria used to filter the list of emails by using Gmail search syntax, such as from:user@example.com, subject:invoice, or after:2024/01/01. |
| Options | Include Attachments | Boolean | Indicates whether to include email attachments in the retrieved emails. |
| Options | Mark as Read | Boolean | Indicates whether to mark the retrieved emails as read. |
| Options | Label Name | InArgument<String> | The Gmail label used to limit the email query. For nested labels, specify the full label name, such as Projects/Active. |
| Options | Retrieve Unread Emails | Boolean | Indicates whether to retrieve only unread emails. |
| Options | Retrieve Top N Emails | InArgument<Int32> | The maximum number of emails to retrieve. The default value is 999. |
| Common | Continue on error | Boolean | Select True for continuing the workflow even if the activity fails. The default value is set to True. |
| Output | Email List | OutArgument<List<Mail>> | The list of retrieved email details, including subject, sender, and date. |
| Output | Total Email Count | OutArgument<Int32> | The total number of retrieved emails. |
| Output | Response code | OutArgument<Int32> | Response code for the activity. |
Activity behavior
Review this behavior of the activity based on the configured input properties and execution results:
- If is selected, the activity appends the
is:unreadfilter to the Gmail search query and retrieves only unread messages. - restricts the search to messages associated with the specified Gmail label.
- If Mark as Read is selected, the activity removes the UNREAD label from each retrieved message
- Response Code indicates the execution status:
200indicates successful execution.502indicates an invalid filter.400or500indicates other processing errors
- Email List contains the retrieved GmailMail objects, which implement the shared Mail interface
Gmail Search Syntax Examples
Use Gmail search syntax to filter and locate emails based on specific criteria such as sender, subject, date, attachment status, and read status. You can also combine multiple search operators to create more targeted searches.
| Query | Description |
|---|---|
| from:user@example.com | Emails from a specific sender |
| subject:invoice | Emails with invoice in the subject |
| after:2024/01/01 | Emails received after a specific date |
| has:attachment | Emails with attachments |
| is:unread | Unread emails only |
| from:user@example.com subject:invoice | Combined filters |