File: doveadm-search-query.7

package info (click to toggle)
dovecot 1%3A2.4.1%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 46,224 kB
  • sloc: ansic: 596,204; makefile: 7,825; sh: 6,005; cpp: 1,866; perl: 487; yacc: 412; lex: 320; python: 253; xml: 232
file content (618 lines) | stat: -rw-r--r-- 10,506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
.TH "DOVEADM-SEARCH-QUERY" "7" "March 2025" "78ffb79" "Dovecot"
.SH "NAME"
\fBdoveadm-search-query\fR - Overview of search queries for doveadm mailbox commands
.SH "DESCRIPTION"
.P
Several doveadm(1) commands use a 
.P
Each \fIsearch_query\fR consists at least of one \fISEARCH KEY\fR. Most of the \fISEARCH KEYS\fR require an argument. All \fISEARCH KEYS\fR are case-insensitive. The shortest valid \fIsearch_query\fR is \fBALL\fR. For example:
.P
.RS 2
.nf
doveadm search ALL
.fi
.RE
.P
Multiple search query expressions will be combined with the \fBAND\fR operator by default. To find all messages that are new and greater than 50 kilobyte, one can use:
.P
.RS 2
.nf
doveadm search NEW LARGER 50k
.fi
.RE
.P
\fBOR\fR-ed \fISEARCH KEYS\fR have to be written in parenthesis, when mixing ANDs and ORs. Shells commonly require escaping for parentheses. To find messages that were saved on the "13th of April 2007" AND have the \[rs]Seen and/or \[rs]Flagged flag set, one can use for example:
.P
.RS 2
.nf
doveadm search SAVEDON 2007-04-13 \[rs]( SEEN OR FLAGGED \[rs])
.fi
.RE
.P
It's also possible to specify the mailbox, in which should be searched. Use either the keyword \fBmailbox\fR and the name of the mailbox or the keyword \fBmailbox-guid\fR and the mailbox's globally unique identifier in the \fIsearch_query\fR. To find all messages in the mailbox with the GUID "44f68b13ce97044b837f000035ca9452" use:
.P
.RS 2
.nf
doveadm search mailbox-guid 44f68b13ce97044b837f000035ca9452 ALL
.fi
.RE
.P
To list all deleted messages in the "Trash" folder use:
.P
.RS 2
.nf
doveadm search mailbox Trash DELETED
.fi
.RE
.SH "SEARCH KEYS"
.P
The following search keys from the specification of IMAP version 4 revision 1 (see: RFC 3501) are supported:
.P
\fIsequence-set\fR
.RS 0
.RS 4
.P
Matches messages with the given sequence numbers. The \fIsequence-set\fR may be a single UID. Can be a sequence range, written as \fIfrom\fR:\fIto\fR, e.g. \fB100\fR:\fB125\fR. As comma separated list of sequences, e.g. \fB11,50,4\fR. It's also possible to combine multiple sequences, e.g. \fB1,3,5,7,10:20\fR. Using ***** selects the last mail in the mailbox.
.P
For example 1:100 matches the first 100 mails and 101:200 the next second hundred mails. 1,5,* matches the first, the fifth and the last email.
.RE 0

.RE 0

.P
\fBALL\fR
.RS 0
.RS 4
.P
Matches all messages.
.RE 0

.RE 0

.P
\fBANSWERED\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Answered set.
.RE 0

.RE 0

.P
\fBBCC\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the BCC field of the message's IMAP envelope structure.
.RE 0

.RE 0

.P
\fBBEFORE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages with an internal date before \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBBODY\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the body part.
.RE 0

.RE 0

.P
\fBCC\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the CC field of the message's IMAP envelope structure.
.RE 0

.RE 0

.P
\fBDELETED\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Deleted set.
.RE 0

.RE 0

.P
\fBDRAFT\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Draft set.
.RE 0

.RE 0

.P
\fBFLAGGED\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Flagged set.
.RE 0

.RE 0

.P
\fBFROM\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the FROM field of the message's IMAP envelope structure.
.RE 0

.RE 0

.P
\fBHEADER\fR \fIfield\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which either have the named header \fIfield\fR, when empty \fIstring\fR was given. Or messages, where the given header \fIfield\fR's value contains the specified \fIstring\fR.
.RE 0

.RE 0

.P
\fBKEYWORD\fR \fIkeyword\fR
.RS 0
.RS 4
.P
Matches messages with the given IMAP \fIkeyword\fR (e.g. $Forwarded) flag set.
.RE 0

.RE 0

.P
\fBLARGER\fR \fIsize\fR
.RS 0
.RS 4
.P
Matches messages that are larger than the specified \fIsize\fR.
.RE 0

.RE 0

.P
\fBMAILBOX\fR \fIname\fR
.RS 0
.RS 4
.P
Matches messages in the mailbox with the specified \fIname\fR.
.RE 0

.RE 0

.P
\fBMAILBOX-GUID\fR \fIguid\fR
.RS 0
.RS 4
.P
Matches messages in the mailbox with the specified \fIguid\fR.
.RE 0

.RE 0

.P
\fBNEW\fR
.RS 0
.RS 4
.P
Matches messages, which have the IMAP flag \[rs]Recent set \fBbut not\fR the IMAP flag \[rs]Seen.
.RE 0

.RE 0

.P
\fBNOT\fR \fIsearch key\fR
.RS 0
.RS 4
.P
Inverse matching - matches massages, where the search doesn't match the specified \fIsearch key\fR or its value.
.RE 0

.RE 0

.P
\fBOLD\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Recent set.
.RE 0

.RE 0

.P
\fBON\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages whose internal date matches the given \fIdate specification\fR.
.RE 0

.RE 0

.P
\fIsearch key\fR \fBOR\fR \fIsearch key\fR
.RS 0
.RS 4
.P
Matches messages where one of the OR-ed search keys matches.
.P
Note: IMAP4rev1 uses the syntax: \fBOR\fR \fIsearch key search key\fR
.RE 0

.RE 0

.P
\fBRECENT\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Recent set.
.RE 0

.RE 0

.P
\fBSEEN\fR
.RS 0
.RS 4
.P
Matches messages with the IMAP flag \[rs]Seen set.
.RE 0

.RE 0

.P
\fBSENTBEFORE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages with a Date: header before \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSENTON\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages with a Date: header matching the given \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSENTSINCE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages with a Date: header matching or after the given \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSINCE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages whose internal date is within or after the given \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSMALLER\fR \fIsize\fR
.RS 0
.RS 4
.P
Matches messages with a size smaller than the given \fIsize\fR.
.RE 0

.RE 0

.P
\fBSUBJECT\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the SUBJECT field of the message's IMAP envelope structure.
.RE 0

.RE 0

.P
\fBTEXT\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the message headers or body.
.RE 0

.RE 0

.P
\fBTO\fR \fIstring\fR
.RS 0
.RS 4
.P
Matches messages, which contain \fIstring\fR in the TO field of the message's IMAP envelope structure.
.RE 0

.RE 0

.P
\fBUID\fR \fIsequence-set\fR
.RS 0
.RS 4
.P
Matches messages with the given IMAP UID(s). See the \fBsequence-set\fR description for details on it. For example \fB1:10,100:200,\fR* matches the UIDs from 1 to 10, 100 to 200 and also the last mail.
.RE 0

.RE 0

.P
\fBUNANSWERED\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Answered set.
.RE 0

.RE 0

.P
\fBUNDELETED\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Deleted set.
.RE 0

.RE 0

.P
\fBUNDRAFT\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Draft set.
.RE 0

.RE 0

.P
\fBUNFLAGGED\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Flagged set.
.RE 0

.RE 0

.P
\fBUNKEYWORD\fR \fIkeyword\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the given IMAP \fIkeyword\fR flag set
.RE 0

.RE 0

.P
\fBUNSEEN\fR
.RS 0
.RS 4
.P
Matches messages, which do not have the IMAP flag \[rs]Seen set.
.RE 0

.RE 0

.SH "DOVEADM SEARCH KEYS"
.P
Additional search keys, provided by doveadm(1).
.P
\fBSAVEDBEFORE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages, which were saved before \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSAVEDON\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages whose save date matches the given \fIdate specification\fR.
.RE 0

.RE 0

.P
\fBSAVEDSINCE\fR \fIdate specification\fR
.RS 0
.RS 4
.P
Matches messages with a save date matching or after the given \fIdate specification\fR.
.RE 0

.RE 0

.SH "DATE SPECIFICATION"
.P
doveadm(1) supports a few additional 
.P
\fIdd-mon-yyyy\fR
.RS 0
.RS 4
.P
Default IMAP4rev1 date format.
.P
Date components:
.RS 4
.P
\fIday\fR : the day of month: \fB1\fR-\fB31\fR.
.RE 0

.RS 4
.P
\fImonth\fR : the abbreviated month name: \fBJan\fR, \fBFeb\fR, \fBMar\fR, \fBApr\fR, \fBMay\fR, \fBJun\fR, \fBJul\fR, \fBAug\fR, \fBSep\fR, \fBOct\fR, \fBNov\fR, or \fBDec\fR.
.RE 0

.RS 4
.P
\fIyear\fR : four digits of year, e.g. \fB2007\fR.
.RE 0

.P
For example the "13th of April 2007" will be represented as \fB13-Apr-2007\fR.
.RE 0

.RE 0

.P
\fIdd-mon-yyyy hh:mm:ss \[lB]+-\[rB]zzzz\fR
.RS 0
.RS 4
.P
Default IMAP4rev1 date-time format. See \fIdd-mon-yyyy\fR above for the date format.
.P
Time format components:
.RS 4
.P
\fIhh\fR : the hour
.RE 0

.RS 4
.P
\fImm\fR : the minute
.RE 0

.RS 4
.P
\fIss\fR : the second
.RE 0

.RS 4
.P
\fI\[lB]+-\[rB]zzzz\fR : the timezone as hhmm, e.g. \fB+0530\fR, \fB-0700\fR
.RE 0

.RE 0

.RE 0

.P
\fIinterval\fR
.RS 0
.RS 4
.P
Combination of a positive integer \fInumber\fR and a \fItime unit\fR.
.P
Available \fItime units\fR are:
.RS 4
.P
\fBweeks\fR : abbreviated: \fBw\fR
.RE 0

.RS 4
.P
\fBdays\fR : abbreviated: \fBd\fR
.RE 0

.RS 4
.P
\fBhours\fR : abbreviated: \fBh\fR
.RE 0

.RS 4
.P
\fBmins\fR : abbreviated: \fBm\fR
.RE 0

.RS 4
.P
\fBsecs\fR : abbreviated: \fBs\fR
.RE 0

.P
To match messages from last week, you may specify for example: \fBsince 1w\fR, \fBsince 1weeks\fR or \fBsince 7days\fR.
.RE 0

.RE 0

.P
\fIUnix timestamp\fR
.RS 0
.RS 4
.P
A 10 digit Unix timestamp, seconds since the 1st of January 1970, 00:00:00 UTC. For example the "13th of April 2007" will be represented as \fB1176418800\fR.
.RE 0

.RE 0

.P
\fIYYYY-MM-DD\fR
.RS 0
.RS 4
.P
Extended ISO-8601 calendar date format. For example the "13th of April 2007" will be represented as \fB2007-04-13\fR.
.RE 0

.RE 0

.SH "SIZE"
.P
doveadm(1) provides also an additional 
.P
\fIoctets\fR
.RS 0
.RS 4
.P
The message size in octets, as specified in the IMAP4rev1 specification.
.RE 0

.RE 0

.P
\fIsize\fR
.RS 0
.RS 4
.P
The message size in \fBB\fR (byte), \fBk\fR (kilobyte), \fBM\fR (megabyte), \fBG\fR (gigabyte) or \fBT\fR (terabyte). To match messages, bigger than 1 megabyte, you may specify for example: \fBlarger 1M\fR or \fBlarger 1024k\fR.
.RE 0

.RE 0

.SH "REPORTING BUGS"
.P
Report bugs, including \fIdoveconf -n\fR output, to the Dovecot Mailing List \fI\(ladovecot@dovecot.org\(ra\fR. Information about reporting bugs is available at: https://dovecot.org/bugreport.html
.SH "SEE ALSO"
.P
doveadm(1)