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 at the
36 beginning of the search_query. To find all messages in the mailbox
37 with the GUID "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 pattern
55 Matches messages, which contain pattern 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 pattern
63 Matches messages, which contain pattern in the body part.
64
65 CC pattern
66 Matches messages, which contain pattern 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 pattern
78 Matches messages, which contain pattern in the FROM field of the
79 message's IMAP envelope structure.
80
81 HEADER field pattern
82 Matches messages, which either have the named header field, when
83 empty pattern was given. Or messages, where the given header
84 field's value contains the specified pattern.
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 NEW Matches messages, which have the IMAP flag \Recent set but not
94 the IMAP flag \Seen.
95
96 NOT search key
97 Inverse matching - matches massages, where the search doesn't
98 match the specified search key or its value.
99
100 OLD Matches messages, which do not have the IMAP flag \Recent set.
101
102 ON date specification
103 Matches messages whose internal date matches the given
104 date specification.
105
106 search key OR search key
107 Matches messages where one of the OR-ed search keys matches.
108 Note: IMAP4rev1 uses the syntax: OR search key search key
109
110 RECENT Matches messages with the IMAP flag \Recent set.
111
112 SEEN Matches messages with the IMAP flag \Seen set.
113
114 SENTBEFORE date specification
115 Matches messages with a Date: header before date specification.
116
117 SENTON date specification
118 Matches messages with a Date: header matching the given
119 date specification.
120
121 SENTSINCE date specification
122 Matches messages with a Date: header matching or after the given
123 date specification.
124
125 SINCE date specification
126 Matches messages whose internal date is within or after the
127 given date specification.
128
129 SMALLER size
130 Matches messages with a size smaller than the given size.
131
132 SUBJECT pattern
133 Matches messages, which contain pattern in the SUBJECT field of
134 the message's IMAP envelope structure.
135
136 TEXT pattern
137 Matches messages, which contain pattern in the message body.
138
139 TO pattern
140 Matches messages, which contain pattern in the TO field of the
141 message's IMAP envelope structure.
142
143 UID sequence
144 Matches messages with the given UID(s). A sequence may be a
145 single UID. Can be a sequence range, written as from:to,
146 e.g. 100:125. As comma separated list of UIDs, e.g. 11,50,4.
147 It's also possible to combine multiple sequences, e.g.
148 1,3,5,7,10:20.
149
150 UNANSWERED
151 Matches messages, which do not have the IMAP flag \Answered set.
152
153 UNDELETED
154 Matches messages, which do not have the IMAP flag \Deleted set.
155
156 UNDRAFT
157 Matches messages, which do not have the IMAP flag \Draft set.
158
159 UNFLAGGED
160 Matches messages, which do not have the IMAP flag \Flagged set.
161
162 UNKEYWORD keyword
163 Matches messages, which do not have the given IMAP keyword flag
164 set
165
166 UNSEEN Matches messages, which do not have the IMAP flag \Seen set.
167
168 DOVEADM SEARCH KEYS
169 Additional search keys, provided by doveadm(1).
170
171 SAVEDBEFORE date specification
172 Matches messages, which were saved before date specification.
173
174 SAVEDON date specification
175 Matches messages whose save date matches the given date specifi‐
176 cation.
177
178 SAVEDSINCE date specification
179 Matches messages with a save date matching or after the given
180 date specification.
181
183 doveadm(1) supports a few additional date specification formats. They
184 can be used anywhere, where a date specification value is obligatory.
185
186 day-month-year
187 Default IMAP4rev1 date format.
188 day, the day of month: 1-31.
189 month, the abbreviated month name: Jan, Feb, Mar, Apr, May, Jun,
190 Jul, Aug, Sep, Oct, Nov or Dec.
191 year, four digits of year, e.g. 2007.
192 For example the "13th of April 2007" will be represented as
193 13-Apr-2007.
194
195 interval
196 Combination of a positive integer number and a time unit.
197 Available time units are: weeks (abbr: w), days (abbr: d), hours
198 (abbr: h), mins (abbr: m) and secs (abbr: s).
199 To match messages from last week, you may specify for example:
200 since 1w, since 1weeks or since 7days.
201
202 Unix timestamp
203 A 10 digit Unix timestamp, seconds since the 1st of January
204 1970, 00:00:00 UTC. For example the "13th of April 2007" will
205 be represented as 1176418800.
206
207 YYYY-MM-DD
208 Extended ISO-8601 calendar date format. For example the "13th
209 of April 2007" will be represented as 2007-04-13.
210
212 doveadm(1) provides also an additional size representation format. The
213 following formats can be used anywhere, where a size value is obliga‐
214 tory.
215
216 octets The message size in octets, as specified in the IMAP4rev1 speci‐
217 fication.
218
219 size The message size in B (byte), k (kilobyte), M (megabyte),
220 G (gigabyte) or T (terabyte).
221 To match messages, bigger than 1 megabyte, you may specify for
222 example: larger 1M or larger 1024k.
223
225 doveadm(1), doveadm-search(1)
226
227
228
229Dovecot v2.0 2010-06-24 DOVEADM-SEARCH-QUERY(7)