Resource: Filter
Resource definition for Gmail filters. Filters apply to specific messages instead of an entire email thread.
JSON representation |
---|
{ "id": string, "criteria": { object ( |
Fields | |
---|---|
id |
The server assigned ID of the filter. |
criteria |
Matching criteria for the filter. |
action |
Action that the filter performs. |
Criteria
Message matching criteria.
JSON representation |
---|
{
"from": string,
"to": string,
"subject": string,
"query": string,
"negatedQuery": string,
"hasAttachment": boolean,
"excludeChats": boolean,
"size": integer,
"sizeComparison": enum ( |
Fields | |
---|---|
from |
The sender's display name or email address. |
to |
The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive. |
subject |
Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed. |
query |
Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, |
negatedQuery |
Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, |
hasAttachment |
Whether the message has any attachment. |
excludeChats |
Whether the response should exclude chats. |
size |
The size of the entire RFC822 message in bytes, including all headers and attachments. |
sizeComparison |
How the message size in bytes should be in relation to the size field. |
SizeComparison
Determines how the size field should be compared to the message size.
Enums | |
---|---|
unspecified |
|
smaller |
Find messages smaller than the given size. |
larger |
Find messages larger than the given size. |
Action
A set of actions to perform on a message.
JSON representation |
---|
{ "addLabelIds": [ string ], "removeLabelIds": [ string ], "forward": string } |
Fields | |
---|---|
addLabelIds[] |
List of labels to add to the message. |
removeLabelIds[] |
List of labels to remove from the message. |
forward |
Email address that the message should be forwarded to. |
Methods |
|
---|---|
|
Creates a filter. |
|
Immediately and permanently deletes the specified filter. |
|
Gets a filter. |
|
Lists the message filters of a Gmail user. |