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 \Answered set.
  • BCC string β€” matches messages which contain string in the BCC field of the message's IMAP envelope structure.
  • BEFORE date specification β€” matches messages with an internal date before date specification.
  • BODY string β€” matches messages which contain string in the body part.
  • CC string β€” matches messages which contain string in the CC field of the message's IMAP envelope structure.
  • DELETED β€” matches messages with the IMAP flag \Deleted set.
  • DRAFT β€” matches messages with the IMAP flag \Draft set.
  • FLAGGED β€” matches messages with the IMAP flag \Flagged set.
  • FROM string β€” matches messages which contain string in the FROM field of the message's IMAP envelope structure.
  • HEADER field 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.
  • KEYWORD keyword β€” matches messages with the given IMAP keyword (e.g. $Forwarded) flag set.
  • LARGER size β€” matches messages that are larger than the specified size.
  • MAILBOX name β€” matches messages in the mailbox with the specified name.
  • MAILBOX-GUID guid β€” matches messages in the mailbox with the specified guid.
  • NEW β€” matches messages which have the IMAP flag \Recent set but not the IMAP flag \Seen.
  • NOT search 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 \Recent set.
  • ON date specification β€” matches messages whose internal date matches the given date specification.
  • search key OR search 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 \Recent set.
  • SEEN β€” matches messages with the IMAP flag \Seen set.
  • SENTBEFORE date specification β€” matches messages with a Date: header before date specification.
  • SENTON date specification β€” matches messages with a Date: header matching the given date specification.
  • SENTSINCE date specification β€” matches messages with a Date: header matching or after the given date specification.
  • SINCE date specification β€” matches messages whose internal date is within or after the given date specification.
  • SMALLER size β€” matches messages with a size smaller than the given size.
  • SUBJECT string β€” matches messages which contain string in the SUBJECT field of the message's IMAP envelope structure.
  • TEXT string β€” matches messages which contain string in the message headers or body.
  • TO string β€” matches messages which contain string in the TO field of the message's IMAP envelope structure.
  • UID sequence-set β€” matches messages with the given IMAP UID(s). See the sequence-set description for details on it. For example 1: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 \Answered set.
  • UNDELETED β€” matches messages which do not have the IMAP flag \Deleted set.
  • UNDRAFT β€” matches messages which do not have the IMAP flag \Draft set.
  • UNFLAGGED β€” matches messages which do not have the IMAP flag \Flagged set.
  • UNKEYWORD keyword β€” matches messages which do not have the given IMAP keyword flag set.
  • UNSEEN β€” matches messages which do not have the IMAP flag \Seen set.

✨ DOVEADM SEARCH KEYS ✨

Additional search keys, provided by doveadm(1). these are the bonus ones, the deluxe edition πŸŽ€

  • SAVEDBEFORE date specification β€” matches messages which were saved before date specification.
  • SAVEDON date specification β€” matches messages whose save date matches the given date specification.
  • SAVEDSINCE date 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, or Dec.
  • 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. See dd-mon-yyyy above for the date format.

Time format components:

  • hh : the hour
  • mm : the minute
  • ss : 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: w
  • days : abbreviated: d
  • hours : abbreviated: h
  • mins : abbreviated: m
  • secs : 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 as 2007-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 in B (byte), k (kilobyte), M (megabyte), G (gigabyte) or T (terabyte). To match messages, bigger than 1 megabyte, you may specify for example: larger 1M or larger 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