Query language

If the advanced form is not enough to configure complex search conditions, use the query language. This enables you to:

  • Limit the search to specific message fields. For example, to search for messages from “Alice” with the “Report” attachment: [from:Alice attachment:Report]
  • Limit the search with a date range. For example, to search for messages from 15.06.16 to 10.07.2016: [date-begin:2016-06-15 date-end:2016-07-10]
  • Search for messages in specific folders or with specific tags. For example, to search in the “From Fluffy” folder: [folder:"Messages from Fluffy"]
  • Combine conditions by using operators. For example, to look for messages from Mad Hatter to Alice and messages to Alice containing “tea” at the same time: [(from:(just.mad.hatter OR Mad Hatter) OR text:tea) AND to:Alice]

    Message fields

    Yandex.Mail usually searches in all message fields and in the currently open folder. You can refine the search and specify the message field to search in. This will make it possible to search separately in the message text, in senders and recipients, and in attachments, as well as to search messages by date, labels, and folders.

    Type several comma-separated fields without spaces to search for the same word in multiple fields. For instance, [from,cc,bcc:Mad Hatter].

    Senders and recipients fields

    Field

    Description

    Syntax

    Query example

    from:

    Search for messages with the sender specified.

    You can search by sender name (“Alice”), login (“alice.the.girl”), and domain (“yandex.com)

    from:word1

    [from:cheshire.katze]

    The system will search for messages that contain "cheshire.katze" in the From field.

    to:

    Search for messages with the recipient specified.

    You can search by sender name (“Alice”), login (“alice.the.girl”), and domain (“yandex.com)

    to:word1

    [to:Alice]

    The system will search for messages that contain "Alice" in the To field.

    cc:

    Search by Cc .

    You can search by sender name (“Alice”), login (“alice.the.girl”), and domain (“yandex.com)

    cc:word1

    [cc:just.mad.hatter]

    The system will search for messages that contain "just.mad.hatter" in the Cc field.

    bcc:

    Search by Bcc.

    You can search by sender name (“Alice”), login (“alice.the.girl”), and domain (“yandex.com)

    bcc:word1

    [bcc:Rabbit]

    The system will search for messages that contain "Rabbit" in the Bcc field.

    Text fields

    Field

    Description

    Syntax

    Query example

    subject:

    Search for messages with the subject specified.

    If a subject contains several words, it should be specified in quotes, or a back slash \ should be added before each space in the title.

    subject:word1

    [subject:"miracle tea"]

    The system will search for messages that contain "miracle tea" in the Subject field.

    Note. If a subject consists of multiple words, use the quote operator ".

    text:

    Search in the message body.
    text:word1

    [text:"Masala tea from India"]

    The system will search for messages with a body that contains "Masala tea from India".

    Attachment fields

    Field

    Description

    Syntax

    Query example

    has-attachments:

    Search for messages with or without attachments.

    To search for messages with attachments, enter “yes” after the operator (without a space); to search for messages without attachments enter “no” ().

    has-attachments:value

    [has-attachments:yes]

    The system will search for messages with attachments.

    attachment:

    filename:

    Search by attachment name.
    attachment:word1

    [attachment:photo]

    The system will search for messages with attachments that contain “photo” in the title.

    Date fields

    Field

    Description

    Syntax

    Query example

    date-begin:

    after:

    and

    date-end:

    Search for messages in the specified date range.

    The date range is specified inclusively.

    You can use these operators separately: date-begin: to search for messages after the specified date; date-end: — until the specified date inclusively.

    date-begin:DDMMYY
    date-begin:YYYY-MM-DD date-end:YYYY-MM-DD

    [date-begin:15.06.16]

    The system will search for messages from 15.06.16 until the current date inclusive.

    [date-begin:2016-06-15 date-end:2016-07-10]

    The system will search for messages from 15.06.16 to 10.07.2016 inclusive.

    before:

    older:

    Search for messages until the specified date exclusive.
    before:DDMMYY
    before:YYYY-MM-DD

    [before:15.06.16]

    The system will search for messages from the mailbox creation date until 14.06.16 inclusive.

    older-than:

    and

    newer-than:

    Search for messages in the specified date range in relation to the current date.

    The value may be specified in hours (“h”), days (“d”) or weeks (“w”).

    older-than:value
    older-than:value newer-than:value

    [older-than:2d]

    The system will search for messages older than two days.

    [older-than:2d newer-than:1w]

    The system will search for messages older than two days but newer than one week.

    Folder and label fields

    Field

    Description

    Syntax

    Query example

    folder:

    Search for messages in the specified folder.

    If a folder name consists of several words, it should be specified in quotes, or a back slash \ should be added before each space in the title.

    folder:word1
    folder:word1\ word2

    [folder:"Messages from Fluffy"]

    [folder:Messages\ from\ Fluffy]

    The system will search for messages from the “Messages from Fluffy” folder.

    label:

    Search for the messages with a specified label.

    If a label name consists of several words, it should be specified in quotes, or a back slash \ should be added before each space in the title.

    To search for unread messages, specify the “unread” label, or the “read” label to search for read messages.

    label:word1
    label:word1\ word2

    [label:"chinese tea"]

    [label::chinese\ tea]

    The system will look for messages that contain the “chinese tea” label.

    Operators

    You can use operators to combine conditions in a query, specify search options, and search for messages with an exact quote.

    You can use multiple space separated operators in one query. For instance, ["Masala from India" subject:tea from:rabbit].

    Operator

    Description

    Syntax

    Query example

    "

    Search for messages that contain the exact phrase (search by quote).

    "word1 word2 ... wordN"

    ["ten impossible things before breakfast"]

    The system will search for messages that contain “ten impossible things before breakfast”.

    -

    Search for messages that do not contain the specified word.

    Only the word preceded by the operator is excluded.

    You can use multiple - operators in one query.

    word1 word2 ... -wordN

    [tea -pu-ehr]

    The system will search for messages that contain “tea”, but do not contain “pu-ehr”.

    [subject:(tea -pu-ehr)]

    [subject:tea -subject:pu-ehr]

    The system will search for messages with a Subject that contains “tea”, but does not contain “pu-ehr”.

    OR

    OR

    Search for messages that contain any word from the query.

    You can use multiple OR operators in one query.

    word1 OR word2 OR ... OR wordN

    [black OR green OR herbal]

    The system will search for messages that contain at least one word from the query: “black”, “green” or “herbal”.

    ()

    Grouping words in complex queries.

    Any operators can be used inside a group included in brackets.

    word1 operator (word2 word3 ... wordN)

    Whether ( should be preceded by a space depends on the syntax of the preceding operator.

    [(from:(just.mad.hatter OR Mad Hatter) OR text:"tea ceremony") AND before:2016-10-11]

    The system will search for messages received before October 11, 2016, that contain just.mad.hatter or “Mad Hatter” in the “From” field, and “tea ceremony” in the body text.