Evidently, the 'doveadm expunge' command requires a "mailbox" to be defined in the search string.
But is there a way tell it all mailboxes for a user? For example, something like:
doveadm expunge -u user@domain mailbox ALL savedbefore 30d
Thanks,
Michael
On 28-12-16 02:31, Michael Fox wrote:
Evidently, the 'doveadm expunge' command requires a "mailbox" to be defined in the search string.
But is there a way tell it all mailboxes for a user? For example, something like:
doveadm expunge -u user@domain mailbox ALL savedbefore 30d
try: doveadm expunge -u user@domain ALL savedbefore 30d
just like the example thats here: http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery
But is there a way tell it all mailboxes for a user? For example, something like:
doveadm expunge -u user@domain mailbox ALL savedbefore 30d
try: doveadm expunge -u user@domain ALL savedbefore 30d
just like the example thats here: http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery
I already tried that. Did you?
For me, expunge returns an error that says the mailbox must be listed.
Also, that example is for search, not expunge.
So, the original question remains: is there a way to specify all mailboxes for a user?
Michael
On 12/29/2016 10:23 PM, Michael Fox wrote:
But is there a way tell it all mailboxes for a user? For example, something like:
doveadm expunge -u user@domain mailbox ALL savedbefore 30d
try: doveadm expunge -u user@domain ALL savedbefore 30d
just like the example thats here: http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery
I already tried that. Did you? For me, expunge returns an error that says the mailbox must be listed. Also, that example is for search, not expunge.
So, the original question remains: is there a way to specify all mailboxes for a user?
doveadm expunge -u <user> mailbox '*' savedbefore 30d
Are you sure you really want to do this? My server expunges Trash and Junk on a cycle, but reaching into other mailboxes seems iffy.
doveadm expunge -u <user> mailbox '*' savedbefore 30d
That doesn't work for me either. The command is accepted, but the messages are not expunged.
I guess my search/fetch will just have to return the mailbox name, in addition to other fields, and then I'll need to loop through the mailbox names and perform multiple expunges for each user. I understand the desire to avoid accidents by requiring that the mailbox be specified. But if "mailbox ALL" or "mailbox '*' were allowed, that would still avoid the accident and yet also avoid the inefficiency of having to perform multiple expunges for one user.
*** Enhancement request: provide a "mailbox all" or "mailbox '*'" option for doveadm search_query so that expunge can be used to remove mail without regard to which mailbox it's in.
Are you sure you really want to do this? My server expunges Trash and Junk on a cycle, but reaching into other mailboxes seems iffy.
Yes. I understand it's unusual. This is an RF (radio) application for emergency services. We have to be efficient about channel utilization. Users know they need to keep their mailboxes clean so that, at the start of an emergency (or other incident), the channel is not clogged with downloading lots of old, irrelevant mail. If they haven't logged in for a while, we'll keep it clear for them.
Michael
On 30-12-16 17:03, Michael Fox wrote:
doveadm expunge -u <user> mailbox '*' savedbefore 30d
That doesn't work for me either. The command is accepted, but the messages are not expunged.
I guess my search/fetch will just have to return the mailbox name, in addition to other fields, and then I'll need to loop through the mailbox names and perform multiple expunges for each user. I understand the desire to avoid accidents by requiring that the mailbox be specified. But if "mailbox ALL" or "mailbox '*' were allowed, that would still avoid the accident and yet also avoid the inefficiency of having to perform multiple expunges for one user.
*** Enhancement request: provide a "mailbox all" or "mailbox '*'" option for doveadm search_query so that expunge can be used to remove mail without regard to which mailbox it's in.
How i read the docs here: http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery and here: http://wiki2.dovecot.org/Tools/Doveadm/Expunge
Is what i can test, but i will/can not test 'expunge' ...
luuk@opensuse:~> doveadm search ALL savedbefore 1800d 0d41613267fb0e4f28190000bbf0c0ec 1 0d41613267fb0e4f28190000bbf0c0ec 2 0d41613267fb0e4f28190000bbf0c0ec 3 luuk@opensuse:~> doveadm fetch date.received ALL before 1800d | sed 's/^L//g' date.received: 2012-01-12 16:11:09
date.received: 2012-01-12 16:25:27
date.received: 2012-01-12 17:26:23
date.received: 2012-01-12 17:27:15
luuk@opensuse:~>
After this, i think this should work: daveadm expunge ALL before 1800d
or, in you case: doveadm expunge -u <user> ALL savedbefore 30d
if this is not working, that this might be a bug?
On 12/30/2016 11:03 AM, Michael Fox wrote:
doveadm expunge -u <user> mailbox '*' savedbefore 30d
That doesn't work for me either. The command is accepted, but the messages are not expunged.
Huh, it certainly did for me, although I used "all" instead of "savedbefore 30d" since I just wanted to empty the trash. What version of Dovecot? Mine is 2.2.27.
Are you sure you really want to do this? My server expunges Trash and Junk on a cycle, but reaching into other mailboxes seems iffy.
Yes. I understand it's unusual. This is an RF (radio) application for emergency services. We have to be efficient about channel utilization. Users know they need to keep their mailboxes clean so that, at the start of an emergency (or other incident), the channel is not clogged with downloading lots of old, irrelevant mail. If they haven't logged in for a while, we'll keep it clear for them.
I guess that's reasonable for a critical application, but normally I would expect an IMAP client to request headers-only, or just recent messages. My phone's K9 client defaults to something like 2 weeks.
Tom.
Huh, it certainly did for me, although I used "all" instead of "savedbefore 30d" since I just wanted to empty the trash. What version of Dovecot? Mine is 2.2.27.
Well, not for me. doveadm search -u user@domain ALL savedbefore 2d -- returns some messages doveadm expunge -u user@domain mailbox '*' savedbefore 2d -- nothing shown, but no error doveadm search -u user@domain ALL savedbefore 2d -- returns the same messages as before
I've got 2.2.9 (Ubuntu package for 14.04)
I guess that's reasonable for a critical application, but normally I would expect an IMAP client to request headers-only, or just recent messages. My phone's K9 client defaults to something like 2 weeks.
Right. But your phone has 100s of kbps or even Mbps of bandwidth, full duplex. But when multiple users are sharing a simplex 56kbps radio channel, even just the headers of old/irrelevant mail are to be avoided.
Michael
Am 2016-12-31 um 07:53 schrieb Michael Fox:
Huh, it certainly did for me, although I used "all" instead of "savedbefore 30d" since I just wanted to empty the trash.
Well, not for me. doveadm search -u user@domain ALL savedbefore 2d -- returns some messages doveadm expunge -u user@domain mailbox '*' savedbefore 2d -- nothing shown, but no error doveadm search -u user@domain ALL savedbefore 2d -- returns the same messages as before
The inefficiency of compiling a list of folders and expunging from each single one seems quite minor to me. That is, as it seems, when "expunge" search-query requires a real mailbox/folder name.
Maybe you can "doveadm move" selected messages to a /fresh/ folder and then expunge that one completely? Slightly less efficient, easier to script though all the time.
-- peter
On 31-12-16 07:53, Michael Fox wrote:
Huh, it certainly did for me, although I used "all" instead of "savedbefore 30d" since I just wanted to empty the trash. What version of Dovecot? Mine is 2.2.27.
Well, not for me. doveadm search -u user@domain ALL savedbefore 2d -- returns some messages doveadm expunge -u user@domain mailbox '*' savedbefore 2d -- nothing shown, but no error doveadm search -u user@domain ALL savedbefore 2d -- returns the same messages as before
I've got 2.2.9 (Ubuntu package for 14.04)
I guess that's reasonable for a critical application, but normally I would expect an IMAP client to request headers-only, or just recent messages. My phone's K9 client defaults to something like 2 weeks.
Right. But your phone has 100s of kbps or even Mbps of bandwidth, full duplex. But when multiple users are sharing a simplex 56kbps radio channel, even just the headers of old/irrelevant mail are to be avoided.
Michael
ok, i did setup a test, and these are the results ;)
sh-4.3# doveadm search -u luuk savedbefore 2d 6e076801a027c655aa700000e4766c2b 1 a11f76379f27c655a4700000e4766c2b 1
sh-4.3# doveadm expunge -u luuk mailbox INBOX savedbefore 2d sh-4.3# doveadm search -u luuk savedbefore 2d 6e076801a027c655aa700000e4766c2b 1 sh-4.3# doveadm fetch -u luuk mailbox savedbefore 2d | sed 's/^L//g' mailbox: Sent
sh-4.3# doveadm expunge -u luuk mailbox '*' savedbefore 2d sh-4.3# doveadm fetch -u luuk mailbox savedbefore 2d | sed 's/^L//g' sh-4.3# doveadm search -u luuk savedbefore 2d sh-4.3#
maybe the debug option '-D' gives a clue why it failes on your site?
doveadm -D expunge -u user@domain mailbox '*' savedbefore 2d
maybe the debug option '-D' gives a clue why it failes on your site?
doveadm -D expunge -u user@domain mailbox '*' savedbefore 2d
I don't see any errors in the debug output. And if there was an error, one would expect to see an error message when running the expunge command even without debugging turned on.
Thanks for trying. I've got to put this aside for a few days to meet a deadline for another project. I'll pick it up with more testing after that.
Michael
participants (4)
-
Luuk
-
Michael Fox
-
Peter Chiochetti
-
Tom Talpey