1DOVEADM-EXPUNGE(1) Dovecot DOVEADM-EXPUNGE(1)
2
3
4
6 doveadm-expunge - Expunge messages matching given search query
7
9 doveadm [-Dv] expunge [-S socket_path] [-d] search_query
10 doveadm [-Dv] expunge [-S socket_path] [-d] -A search_query
11 doveadm [-Dv] expunge [-S socket_path] [-d] -F file search_query
12 doveadm [-Dv] expunge [-S socket_path] [-d] -u user search_query
13
15 This command can be used to expunge mails matching the given search
16 query. It is typically used to expunge old mails from users' Trash
17 and/or Spam mailboxes. To test which messages a given search query
18 would match, you can use doveadm fetch or doveadm search commands.
19
20 In the first form, doveadm(1) will execute the expunge action with the
21 environment of the logged in system user.
22
23 In the second form, the command will be performed for all users.
24
25 In the third form, doveadm(1) will expunge messages of the users listed
26 in the given file.
27
28 In the fourth form, only matching mails of the given user(s) will be
29 expunged.
30
32 Global doveadm(1) options:
33
34 -D Enables verbosity and debug messages.
35
36 -o setting=value
37 Overrides the configuration setting from /etc/dovecot/dove‐
38 cot.conf and from the userdb with the given value. In order to
39 override multiple settings, the -o option may be specified mul‐
40 tiple times.
41
42 -v Enables verbosity, including progress counter.
43
44 Command specific options:
45
46 -A If the -A option is present, the command will be performed for
47 all users. Using this option in combination with system users
48 from userdb { driver = passwd } is not recommended, because it
49 contains also users with a lower UID than the one configured
50 with the first_valid_uid setting.
51
52 When the SQL userdb module is used make sure that the iter‐
53 ate_query setting in /etc/dovecot/dovecot-sql.conf.ext matches
54 your database layout. When using the LDAP userdb module, make
55 sure that the iterate_attrs and iterate_filter settings in
56 /etc/dovecot/dovecot-ldap.conf.ext match your LDAP schema. Oth‐
57 erwise doveadm(1) will be unable to iterate over all users.
58
59 -F file
60 Execute the command for all the users in the file. This is sim‐
61 ilar to the -A option, but instead of getting the list of users
62 from the userdb, they are read from the given file. The file
63 contains one username per line.
64
65 -d Delete the mailbox if it is empty after expunging.
66
67 -S socket_path
68 The option's argument is either an absolute path to a local UNIX
69 domain socket, or a hostname and port (hostname:port), in order
70 to connect a remote host via a TCP socket.
71
72 This allows an administrator to execute doveadm(1) mail commands
73 through the given socket.
74
75 -u user/mask
76 Run the command only for the given user. It's also possible to
77 use '*' and '?' wildcards (e.g. -u *@example.org).
78 When neither the -A option, nor the -F file option, nor the
79 -u user was specified, the command will be executed with the
80 environment of the currently logged in user.
81
83 search_query
84 Expunge messages matching this search query. See
85 doveadm-search-query(7) for details.
86
88 This example expunges messages from Spam mailbox that were saved/copied
89 there more than two weeks ago:
90
91 doveadm expunge -u jane.doe@example.org mailbox Spam savedbefore 2w
92
94 Report bugs, including doveconf -n output, to the Dovecot Mailing List
95 <dovecot@dovecot.org>. Information about reporting bugs is available
96 at: http://dovecot.org/bugreport.html
97
99 doveadm(1), doveadm-fetch(1), doveadm-purge(1), doveadm-search(1),
100 doveadm-search-query(7)
101
102
103
104Dovecot v2.3 2015-05-09 DOVEADM-EXPUNGE(1)