1DOVEADM-SEARCH-QUERY(7) Dovecot DOVEADM-SEARCH-QUERY(7)
2
3
4
6 doveadm-search-query - Overview of search queries for doveadm mailbox
7 commands
8
10 Several doveadm(1) commands use a search_query in order to act only on
11 matching messages. This manual page describes all SEARCH KEYS, which
12 can be used in a search_query. The query is mostly compatible with the
13 IMAP SEARCH command parameters, although there are some differences.
14
15 Each search_query consists at least of one SEARCH KEY. Most of the
16 SEARCH KEYS require an argument. All SEARCH KEYS are case-insensitive.
17 The shortest valid search_query is ALL. For example:
18
19 doveadm search ALL
20
21 Multiple search query expressions will be combined with the AND opera‐
22 tor by default. To find all messages that are new and greater than 50
23 kilobyte, one can use:
24
25 doveadm search NEW LARGER 50k
26
27 OR-ed SEARCH KEYS have to be written in parenthesis, when mixing ANDs
28 and ORs. Shells commonly require escaping for parentheses. To find
29 messages that were saved on the "13th of April 2007" AND have the
30 \Seen and/or \Flagged flag set, one can use for example:
31
32 doveadm search SAVEDON 2007-04-13 \( SEEN OR FLAGGED \)
33
34 It's also possible to specify the mailbox, in which should be searched.
35 Use either the keyword mailbox and the name of the mailbox or the key‐
36 word mailbox-guid and the mailbox's globally unique identifier in the
37 search_query. To find all messages in the mailbox with the GUID
38 "44f68b13ce97044b837f000035ca9452" use:
39
40 doveadm search mailbox-guid 44f68b13ce97044b837f000035ca9452 ALL
41
42 To list all deleted messages in the "Trash" folder use:
43
44 doveadm search mailbox Trash DELETED
45
47 The following search keys from the specification of IMAP version 4
48 revision 1 (see: RFC 3501, section 6.4.4) are supported:
49
50 sequence-set
51 Matches messages with the given sequence numbers. The
52 sequence-set may be a single UID. Can be a sequence range,
53 written as from:to, e.g. 100:125. As comma separated list of
54 sequences, e.g. 11,50,4. It's also possible to combine multi‐
55 ple sequences, e.g. 1,3,5,7,10:20. Using * selects the last
56 mail in the mailbox.
57 For example 1:100 matches the first 100 mails and 101:200 the
58 next second hundred mails. 1,5,* matches the first, the fifth
59 and the last email.
60
61 ALL Matches all messages.
62
63 ANSWERED
64 Matches messages with the IMAP flag \Answered set.
65
66 BCC string
67 Matches messages, which contain string in the BCC field of the
68 message's IMAP envelope structure.
69
70 BEFORE date specification
71 Matches messages with an internal date before date specifica‐
72 tion.
73
74 BODY string
75 Matches messages, which contain string in the body part.
76
77 CC string
78 Matches messages, which contain string in the CC field of the
79 message's IMAP envelope structure.
80
81 DELETED
82 Matches messages with the IMAP flag \Deleted set.
83
84 DRAFT Matches messages with the IMAP flag \Draft set.
85
86 FLAGGED
87 Matches messages with the IMAP flag \Flagged set.
88
89 FROM string
90 Matches messages, which contain string in the FROM field of the
91 message's IMAP envelope structure.
92
93 HEADER field string
94 Matches messages, which either have the named header field, when
95 empty string was given. Or messages, where the given header
96 field's value contains the specified string.
97
98 KEYWORD keyword
99 Matches messages with the given IMAP keyword (e.g. $Forwarded)
100 flag set.
101
102 LARGER size
103 Matches messages that are larger than the specified size.
104
105 MAILBOX name
106 Matches messages in the mailbox with the specified name.
107
108 MAILBOX-GUID guid
109 Matches messages in the mailbox with the specified guid.
110
111 NEW Matches messages, which have the IMAP flag \Recent set but not
112 the IMAP flag \Seen.
113
114 NOT search key
115 Inverse matching - matches massages, where the search doesn't
116 match the specified search key or its value.
117
118 OLD Matches messages, which do not have the IMAP flag \Recent set.
119
120 ON date specification
121 Matches messages whose internal date matches the given
122 date specification.
123
124 search key OR search key
125 Matches messages where one of the OR-ed search keys matches.
126 Note: IMAP4rev1 uses the syntax: OR search key search key
127
128 RECENT Matches messages with the IMAP flag \Recent set.
129
130 SEEN Matches messages with the IMAP flag \Seen set.
131
132 SENTBEFORE date specification
133 Matches messages with a Date: header before date specification.
134
135 SENTON date specification
136 Matches messages with a Date: header matching the given
137 date specification.
138
139 SENTSINCE date specification
140 Matches messages with a Date: header matching or after the given
141 date specification.
142
143 SINCE date specification
144 Matches messages whose internal date is within or after the
145 given date specification.
146
147 SMALLER size
148 Matches messages with a size smaller than the given size.
149
150 SUBJECT string
151 Matches messages, which contain string in the SUBJECT field of
152 the message's IMAP envelope structure.
153
154 TEXT string
155 Matches messages, which contain string in the message headers or
156 body.
157
158 TO string
159 Matches messages, which contain string in the TO field of the
160 message's IMAP envelope structure.
161
162 UID sequence-set
163 Matches messages with the given IMAP UID(s). See the
164 sequence-set description for details on it. For example
165 1:10,100:200,* matches the UIDs from 1 to 10, 100 to 200 and
166 also the last mail.
167
168 UNANSWERED
169 Matches messages, which do not have the IMAP flag \Answered set.
170
171 UNDELETED
172 Matches messages, which do not have the IMAP flag \Deleted set.
173
174 UNDRAFT
175 Matches messages, which do not have the IMAP flag \Draft set.
176
177 UNFLAGGED
178 Matches messages, which do not have the IMAP flag \Flagged set.
179
180 UNKEYWORD keyword
181 Matches messages, which do not have the given IMAP keyword flag
182 set
183
184 UNSEEN Matches messages, which do not have the IMAP flag \Seen set.
185
186 DOVEADM SEARCH KEYS
187 Additional search keys, provided by doveadm(1).
188
189 SAVEDBEFORE date specification
190 Matches messages, which were saved before date specification.
191
192 SAVEDON date specification
193 Matches messages whose save date matches the given date specifi‐
194 cation.
195
196 SAVEDSINCE date specification
197 Matches messages with a save date matching or after the given
198 date specification.
199
201 doveadm(1) supports a few additional date specification formats. They
202 can be used anywhere, where a date specification value is obligatory.
203
204 day-month-year
205 Default IMAP4rev1 date format.
206 day, the day of month: 1-31.
207 month, the abbreviated month name: Jan, Feb, Mar, Apr, May, Jun,
208 Jul, Aug, Sep, Oct, Nov or Dec.
209 year, four digits of year, e.g. 2007.
210 For example the "13th of April 2007" will be represented as
211 13-Apr-2007.
212
213 interval
214 Combination of a positive integer number and a time unit.
215 Available time units are: weeks (abbr: w), days (abbr: d), hours
216 (abbr: h), mins (abbr: m) and secs (abbr: s).
217 To match messages from last week, you may specify for example:
218 since 1w, since 1weeks or since 7days.
219
220 Unix timestamp
221 A 10 digit Unix timestamp, seconds since the 1st of January
222 1970, 00:00:00 UTC. For example the "13th of April 2007" will
223 be represented as 1176418800.
224
225 YYYY-MM-DD
226 Extended ISO-8601 calendar date format. For example the "13th
227 of April 2007" will be represented as 2007-04-13.
228
230 doveadm(1) provides also an additional size representation format. The
231 following formats can be used anywhere, where a size value is obliga‐
232 tory.
233
234 octets The message size in octets, as specified in the IMAP4rev1 speci‐
235 fication.
236
237 size The message size in B (byte), k (kilobyte), M (megabyte),
238 G (gigabyte) or T (terabyte).
239 To match messages, bigger than 1 megabyte, you may specify for
240 example: larger 1M or larger 1024k.
241
243 doveadm(1), doveadm-search(1)
244
245
246
247Dovecot v2.3 2015-10-19 DOVEADM-SEARCH-QUERY(7)