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