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 body.
156
157 TO string
158 Matches messages, which contain string in the TO field of the
159 message's IMAP envelope structure.
160
161 UID sequence-set
162 Matches messages with the given IMAP UID(s). See the
163 sequence-set description for details on it. For example
164 1:10,100:200,* matches the UIDs from 1 to 10, 100 to 200 and
165 also the last mail.
166
167 UNANSWERED
168 Matches messages, which do not have the IMAP flag \Answered set.
169
170 UNDELETED
171 Matches messages, which do not have the IMAP flag \Deleted set.
172
173 UNDRAFT
174 Matches messages, which do not have the IMAP flag \Draft set.
175
176 UNFLAGGED
177 Matches messages, which do not have the IMAP flag \Flagged set.
178
179 UNKEYWORD keyword
180 Matches messages, which do not have the given IMAP keyword flag
181 set
182
183 UNSEEN Matches messages, which do not have the IMAP flag \Seen set.
184
185 DOVEADM SEARCH KEYS
186 Additional search keys, provided by doveadm(1).
187
188 SAVEDBEFORE date specification
189 Matches messages, which were saved before date specification.
190
191 SAVEDON date specification
192 Matches messages whose save date matches the given date specifi‐
193 cation.
194
195 SAVEDSINCE date specification
196 Matches messages with a save date matching or after the given
197 date specification.
198
200 doveadm(1) supports a few additional date specification formats. They
201 can be used anywhere, where a date specification value is obligatory.
202
203 day-month-year
204 Default IMAP4rev1 date format.
205 day, the day of month: 1-31.
206 month, the abbreviated month name: Jan, Feb, Mar, Apr, May, Jun,
207 Jul, Aug, Sep, Oct, Nov or Dec.
208 year, four digits of year, e.g. 2007.
209 For example the "13th of April 2007" will be represented as
210 13-Apr-2007.
211
212 interval
213 Combination of a positive integer number and a time unit.
214 Available time units are: weeks (abbr: w), days (abbr: d), hours
215 (abbr: h), mins (abbr: m) and secs (abbr: s).
216 To match messages from last week, you may specify for example:
217 since 1w, since 1weeks or since 7days.
218
219 Unix timestamp
220 A 10 digit Unix timestamp, seconds since the 1st of January
221 1970, 00:00:00 UTC. For example the "13th of April 2007" will
222 be represented as 1176418800.
223
224 YYYY-MM-DD
225 Extended ISO-8601 calendar date format. For example the "13th
226 of April 2007" will be represented as 2007-04-13.
227
229 doveadm(1) provides also an additional size representation format. The
230 following formats can be used anywhere, where a size value is obliga‐
231 tory.
232
233 octets The message size in octets, as specified in the IMAP4rev1 speci‐
234 fication.
235
236 size The message size in B (byte), k (kilobyte), M (megabyte),
237 G (gigabyte) or T (terabyte).
238 To match messages, bigger than 1 megabyte, you may specify for
239 example: larger 1M or larger 1024k.
240
242 doveadm(1), doveadm-search(1)
243
244
245
246Dovecot v2.3 2015-10-19 DOVEADM-SEARCH-QUERY(7)