Custom Query

Use the information on this page to structure your custom IMAP search queries in the component.

IMAP Search query

The standard IMAP query, supported by the component, should be specified in the following format:

KEY ARGUMENTS

Where:

  • KEY: an IMAP query key.
  • ARGUMENTS: a list of arguments specified for the key separated with a single space.

The following restrictions should be applied when you specify a custom query in the component:

  • Do not tie expressions with a logical 'AND' operator.
    Any query that contains the logical 'AND' explicitly specified by the user will fail.
  • Do not use extra spaces in the query.
    Any expression should be delimited with only one space; otherwise, the query will fail. When you specify a multiline query, each line-break is equal to one space. Spaces within a string argument are not counted.
  • Do not break an expression into different lines.
  • Enclose the string argument with double quotes.
    A one-word string argument can be specified without quotes.
  • Use parentheses to enclose complex expressions.
    It is possible to specify any number of query expressions in a single line without any parentheses, but it is highly recommended to use parentheses to enclose any complex expression within query to make sure that the intended logic of the query is preserved. This is especially important when you use 'OR' and NOT' operators in your query. You cannot break an expression enclosed with parentheses into different lines.

Examples

The following examples provide you with sample references:

Query specified in one line:


(OR (OR (FROM "Craig.Johnson@gmail.com") (FROM "Anna Jefferson")) FROM "Joseph D. Letlen") (NOT SUBJECT "Private")
Here, the parentheses are used to show the logical relations between two main expressions.

Multiline query:


FROM "Brian Anderson"
SUBJECT "Sunday project"
NOT LARGER 20400000