DOVEADM-SEARCH-QUERY(7)
π NAME π
okay so bestie, welcome to doveadm-search-query β that's the manual page, section 7, straight from the Dovecot fam. π¦ It's the overview of search queries for doveadm mailbox commands, and it's lowkey the glow-up guide for telling doveadm exactly which messages you mean. no cap. β¨
πΈ DESCRIPTION πΈ
Several doveadm(1) commands take a search_query so they only act on the messages that actually match. This page describes all the SEARCH KEYS you can drop into a search_query. The query is mostly compatible with the IMAP SEARCH command parameters, although there are some differences. iykyk.
Every search_query consists of at least one SEARCH KEY. Most of the SEARCH KEYS require an argument. All SEARCH KEYS are case-insensitive. The shortest valid search_query is ALL. Like, for example:
doveadm search ALL
Multiple search query expressions get combined with the AND operator by default. So to find all the messages that are new and greater than 50 kilobyte, you can use:
doveadm search NEW LARGER 50k
OR-ed SEARCH KEYS have to be written in parenthesis whenever you're 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 \Seen and/or \Flagged flag set, you can use for example:
doveadm search SAVEDON 2007-04-13 \( SEEN OR FLAGGED \)
It's also possible to specify the mailbox in which should be searched. Use either the keyword mailbox and the name of the mailbox, or the keyword mailbox-guid and the mailbox's globally unique identifier, in the search_query. To find all messages in the mailbox with the GUID 44f68b13ce97044b837f000035ca9452 use:
doveadm search mailbox-guid 44f68b13ce97044b837f000035ca9452 ALL
To list all deleted messages in the Trash folder use:
doveadm search mailbox Trash DELETED
π SEARCH KEYS π
The following search keys from the specification of IMAP version 4 revision 1 (see: RFC 3501) are supported:
sequence-setβ matches messages with the given sequence numbers.
The sequence-set may be a single sequence number. Can be a sequence range, written as from:to, e.g. 100:125. As comma separated list of sequences, e.g. 11,50,4. It's also possible to combine multiple sequences, e.g. 1,3,5,7,10:20. Using * selects the last mail in the mailbox.
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.
Use UID (see below) to search by unique ID.
ALLβ matches all messages. literally all of them, she's generous πANSWEREDβ matches messages with the IMAP flag\Answeredset.BCCstring β matches messages which contain string in the BCC field of the message's IMAP envelope structure.BEFOREdate specification β matches messages with an internal date before date specification.BODYstring β matches messages which contain string in the body part.CCstring β matches messages which contain string in the CC field of the message's IMAP envelope structure.DELETEDβ matches messages with the IMAP flag\Deletedset.DRAFTβ matches messages with the IMAP flag\Draftset.FLAGGEDβ matches messages with the IMAP flag\Flaggedset.FROMstring β matches messages which contain string in the FROM field of the message's IMAP envelope structure.HEADERfield string β matches messages which either have the named header field, when empty string was given. Or messages where the given header field's value contains the specified string.KEYWORDkeyword β matches messages with the given IMAP keyword (e.g.$Forwarded) flag set.LARGERsize β matches messages that are larger than the specified size.MAILBOXname β matches messages in the mailbox with the specified name.MAILBOX-GUIDguid β matches messages in the mailbox with the specified guid.NEWβ matches messages which have the IMAP flag\Recentset but not the IMAP flag\Seen.NOTsearch key β inverse matching β matches messages where the search doesn't match the specified search key or its value. she's the opposite of a hater, she's the hater πOLDβ matches messages which do not have the IMAP flag\Recentset.ONdate specification β matches messages whose internal date matches the given date specification.- search key
ORsearch key β matches messages where one of the OR-ed search keys matches.
Note: IMAP4rev1 uses the syntax: OR search key search key
RECENTβ matches messages with the IMAP flag\Recentset.SEENβ matches messages with the IMAP flag\Seenset.SENTBEFOREdate specification β matches messages with aDate:header before date specification.SENTONdate specification β matches messages with aDate:header matching the given date specification.SENTSINCEdate specification β matches messages with aDate:header matching or after the given date specification.SINCEdate specification β matches messages whose internal date is within or after the given date specification.SMALLERsize β matches messages with a size smaller than the given size.SUBJECTstring β matches messages which contain string in the SUBJECT field of the message's IMAP envelope structure.TEXTstring β matches messages which contain string in the message headers or body.TOstring β matches messages which contain string in the TO field of the message's IMAP envelope structure.UIDsequence-set β matches messages with the given IMAP UID(s). See thesequence-setdescription for details on it. For example1:10,100:200,*matches the UIDs from 1 to 10, 100 to 200 and also the last mail.UNANSWEREDβ matches messages which do not have the IMAP flag\Answeredset.UNDELETEDβ matches messages which do not have the IMAP flag\Deletedset.UNDRAFTβ matches messages which do not have the IMAP flag\Draftset.UNFLAGGEDβ matches messages which do not have the IMAP flag\Flaggedset.UNKEYWORDkeyword β matches messages which do not have the given IMAP keyword flag set.UNSEENβ matches messages which do not have the IMAP flag\Seenset.
β¨ DOVEADM SEARCH KEYS β¨
Additional search keys, provided by doveadm(1). these are the bonus ones, the deluxe edition π
SAVEDBEFOREdate specification β matches messages which were saved before date specification.SAVEDONdate specification β matches messages whose save date matches the given date specification.SAVEDSINCEdate specification β matches messages with a save date matching or after the given date specification.
π DATE SPECIFICATION π
doveadm(1) supports a few additional date specification formats. They can be used anywhere where a date specification value is obligatory. slay, options π
dd-mon-yyyyβ default IMAP4rev1 date format.
Date components:
day: the day of month:1-31.month: the abbreviated month name:Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov, orDec.year: four digits of year, e.g.2007.
For example the "13th of April 2007" will be represented as 13-Apr-2007.
dd-mon-yyyy hh:mm:ss [+-]zzzzβ default IMAP4rev1 date-time format. Seedd-mon-yyyyabove for the date format.
Time format components:
hh: the hourmm: the minutess: the second[+-]zzzz: the timezone as hhmm, e.g.+0530,-0700
- interval β combination of a positive integer number and a time unit.
Available time units are:
weeks: abbreviated:wdays: abbreviated:dhours: abbreviated:hmins: abbreviated:msecs: abbreviated:s
To match messages from last week, you may specify for example: since 1w, since 1weeks or since 7days.
- Unix timestamp β 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
1176418800. YYYY-MM-DDβ extended ISO-8601 calendar date format. For example the "13th of April 2007" will be represented as2007-04-13.
π¦ SIZE π¦
doveadm(1) provides also an additional size representation format. The following formats can be used anywhere where a size value is obligatory. she's got range, fr fr π
octetsβ the message size in octets, as specified in the IMAP4rev1 specification.sizeβ the message size inB(byte),k(kilobyte),M(megabyte),G(gigabyte) orT(terabyte). To match messages, bigger than 1 megabyte, you may specify for example:larger 1Morlarger 1024k.
π REPORTING BUGS π
Report bugs, including doveconf -n output, to the Dovecot Mailing List β¨dovecot@dovecot.orgβ©. Information about reporting bugs is available at: β¨https://dovecot.org/bugreport.htmlβ©
bestie if something's acting up, don't gatekeep it from the devs β send the receipt (aka that doveconf -n output) π
π SEE ALSO π
doveadm(1)β the main character, go read her too π
and that's the whole page, bestie!! π this was DOVEADM-SEARCH-QUERY(7), version f979264, dated April 2026, courtesy of Dovecot. now go forth and search some mail, you ate that ππβ¨
π¦ where this page comes from
- alpine 3.23: dovecot-doc 2.4.5-r0 Β· MIT AND LGPL-2.1-or-later
- alpine 3.24: dovecot-doc 2.4.5-r0 Β· MIT AND LGPL-2.1-or-later
- arch rolling: dovecot 2.4.5-1 Β· MIT AND LGPL-2.1-only
- fedora 43: dovecot 1:2.4.5-1.fc43 Β· MIT AND LGPL-2.1-only
- fedora 44: dovecot 1:2.4.5-1.fc44 Β· MIT AND LGPL-2.1-only
- nixos 26.05: dovecot 2.4.5
- nixpkgs unstable: dovecot 2.4.5
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- opensuse-leap 16.0: dovecot24 2.4.5-160000.1.1 Β· BSD-3-Clause AND LGPL-2.1-or-later AND MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms