1DOVEADM-SEARCH(1) Dovecot DOVEADM-SEARCH(1)
2
3
4
6 doveadm-search - Show a list of mailbox GUIDs and message UIDs matching
7 given search query.
8
10 doveadm [-Dv] [-f formatter] search [-S socket_path] search_query
11 doveadm [-Dv] [-f formatter] search [-S socket_path] -A search_query
12 doveadm [-Dv] [-f formatter] search [-S socket_path] -F file
13 search_query
14 doveadm [-Dv] [-f formatter] search [-S socket_path] -u user
15 search_query
16
18 The search command is used to find matching messages. doveadm(1) will
19 print the mailbox's guid and the message's uid for each match.
20 When used with the -A or -u wildcard options, doveadm(1) will print the
21 fields username, mailbox-guid and uid for each matching message.
22
23 In the first form, doveadm(1) will executed the search action with the
24 environment of the logged in system user.
25
26 In the second form, the command will be performed for all users.
27
28 In the third form, the command will be performed for all users listed
29 in the given file.
30
31 In the fourth form, only matching mails of the given user(s) will be
32 searched.
33
35 Global doveadm(1) options:
36
37 -D Enables verbosity and debug messages.
38
39 -f formatter
40 Specifies the formatter for formatting the output. Supported
41 formatters are:
42
43 flow prints each line with key=value pairs.
44
45 pager prints each key: value pair on its own line and separates
46 records with form feed character (^L).
47
48 tab prints a table header followed by tab separated value
49 lines.
50
51 table prints a table header followed by adjusted value lines.
52
53 -o setting=value
54 Overrides the configuration setting from /etc/dovecot/dove‐
55 cot.conf and from the userdb with the given value. In order to
56 override multiple settings, the -o option may be specified mul‐
57 tiple times.
58
59 -v Enables verbosity, including progress counter.
60
61 This command uses by default the output formatter flow (without the
62 key= prefix).
63
64 Command specific options:
65
66 -A If the -A option is present, the command will be performed for
67 all users. Using this option in combination with system users
68 from userdb { driver = passwd } is not recommended, because it
69 contains also users with a lower UID than the one configured
70 with the first_valid_uid setting.
71
72 When the SQL userdb module is used make sure that the iter‐
73 ate_query setting in /etc/dovecot/dovecot-sql.conf.ext matches
74 your database layout. When using the LDAP userdb module, make
75 sure that the iterate_attrs and iterate_filter settings in
76 /etc/dovecot/dovecot-ldap.conf.ext match your LDAP schema. Oth‐
77 erwise doveadm(1) will be unable to iterate over all users.
78
79 -F file
80 Execute the command for all the users in the file. This is sim‐
81 ilar to the -A option, but instead of getting the list of users
82 from the userdb, they are read from the given file. The file
83 contains one username per line.
84
85 -S socket_path
86 The option's argument is either an absolute path to a local UNIX
87 domain socket, or a hostname and port (hostname:port), in order
88 to connect a remote host via a TCP socket.
89
90 This allows an administrator to execute doveadm(1) mail commands
91 through the given socket.
92
93 -u user/mask
94 Run the command only for the given user. It's also possible to
95 use '*' and '?' wildcards (e.g. -u *@example.org).
96 When neither the -A option, nor the -F file option, nor the
97 -u user was specified, the command will be executed with the
98 environment of the currently logged in user.
99
101 search_query
102 Show messages matching this search query. See
103 doveadm-search-query(7) for details.
104
106 This example demonstrates how to search in user bob's dovecot mailboxes
107 all messages, which contains the word "todo" in the Subject: header.
108
109 doveadm search -u bob mailbox dovecot\* subject todo
110 3a94c928d66ebe4bda04000015811c6a 8
111 3a94c928d66ebe4bda04000015811c6a 25
112 3a94c928d66ebe4bda04000015811c6a 45
113
114 The search command is mainly useful when used together with
115 doveadm fetch command. For example to save message bodies of all mes‐
116 sages from INBOX that have "todo" in subject, use:
117
118 doveadm search -u bob mailbox INBOX subject todo |
119 while read guid uid; do
120 doveadm fetch -u bob body mailbox-guid $guid uid $uid > msg.$uid
121 done
122
124 Report bugs, including doveconf -n output, to the Dovecot Mailing List
125 <dovecot@dovecot.org>. Information about reporting bugs is available
126 at: http://dovecot.org/bugreport.html
127
129 doveadm(1), doveadm-fetch(1), doveadm-search-query(7)
130
131
132
133Dovecot v2.3 2015-05-09 DOVEADM-SEARCH(1)