Query language

If the advanced form does not allow you to enter sufficiently complex search criteria, use query language. This enables you to:

  • Restrict your search to specific message fields. For example, you can search for messages from “Alice” with the “Report” attachment: [from:Alice attachment:Report]
  • Restrict your search to a particular date range. For example, you can 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, you can search in the “From Fluffy” folder: [folder:"From Fluffy"]
  • Combine conditions by using operators. For example, you can 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]
  1. Message fields
  2. Operators

Message fields

Yandex.Mail usually searches all message fields in the folder that is currently open. You can limit your search to a specific message field. That way the service will only search the field you indicate, such as message text, senders or recipients, or attachments. You can also search by date, labels, or folders.

To search for the same word in multiple fields, enter several fields separated by commas (with no spaces). For instance, [from,cc,bcc:Mad Hatter].

Senders and recipients fields

Field

Description

Syntax

Query example

from:

Searches for messages from a specific sender.

You can search by the sender's name (“Alice”), username (“alice.the.girl”), or domain (“yandex.com)

from:word1

[from:cheshire.katze]

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

to:

Searches for messages sent to a particular recipient.

You can search by the sender's name (“Alice”), username (“alice.the.girl”), or domain (“yandex.com)

to:word1

[to:Alice]

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

cc:

Searches by Cc .

You can search by the sender's name (“Alice”), username (“alice.the.girl”), or 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:

Searches by Bcc.

You can search by the sender's name (“Alice”), username (“alice.the.girl”), or 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:

Searches for messages with a particular subject.

If a subject contains several words, surround them with quotes, or put a back slash \ 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 quotation mark operator ".

text:

Searches in the message body.
text:word1

[text:"Masala tea from India"]

The system will search for messages with the words "Masala tea from India" in the text body.

Attachment fields

Field

Description

Syntax

Query example

has-attachments:

Searches 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:

Searches 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:

Searches for messages in a particular date range.

The date range you enter should be inclusive.

You can use these operators separately: date-begin: to search for messages after a specific date; date-end: — to search for messages through a specific date.

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 through the current date.

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

The system will search for messages from 15.06.16 through 10.07.2016.

before:

older:

Searches for messages up to (but not including) the specified date.
before:DDMMYY
before:YYYY-MM-DD

[before:15.06.16]

The system will search for messages from the date the mailbox was created through 14.06.16.

older-than:

and

newer-than:

Searches for messages in a specific 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 that are at least two days old.

[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:

Searches for messages in a particular folder.

If a folder name consists of several words, it should either be enclosed 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.