Hello
where can I setup dovecot to auto clear trash periodically? for example, I want the messages in trash folder to be kept up to 20 days.
Thanks.
On Tue, 2024/11/12 at 03:45:57 +0100, Ralph Seichter via dovecot wrote:
- Hua Young via dovecot:
where can I setup dovecot to auto clear trash periodically?
See the doveadm-expunge(1) manual page for one possible way to do that, when combined with a cron job or similar.
DATESTR=$(date --date='TZ="UTC" 0 2 week ago' +'%d-%b-%Y') doveadm expunge -u <user> mailbox Trash before ${DATESTR}
Adjust to taste. And careful with expunge if you run it on other mailboxes than Junk and Trash. Always qualify the search with 'deleted' when you do that.
Use 'doveadm search -u <user> mailbox ...' to make sure that you see what you expect to see from the query before you put the search string to use in an expunge. doveadm-search and doveadm-search-query man pages were helpful when I was learning this.
-- Kind regards,
/S
On 12/11/2024 09:12 EET Sirius via dovecot dovecot@dovecot.org wrote:
On Tue, 2024/11/12 at 03:45:57 +0100, Ralph Seichter via dovecot wrote:
- Hua Young via dovecot:
where can I setup dovecot to auto clear trash periodically?
See the doveadm-expunge(1) manual page for one possible way to do that, when combined with a cron job or similar.
DATESTR=$(date --date='TZ="UTC" 0 2 week ago' +'%d-%b-%Y') doveadm expunge -u <user> mailbox Trash before ${DATESTR}
Adjust to taste. And careful with expunge if you run it on other mailboxes than Junk and Trash. Always qualify the search with 'deleted' when you do that.
Use 'doveadm search -u <user> mailbox ...' to make sure that you see what you expect to see from the query before you put the search string to use in an expunge. doveadm-search and doveadm-search-query man pages were helpful when I was learning this.
-- Kind regards,
/S
Or you can use the more modern way,
https://doc.dovecot.org/2.3/configuration_manual/namespace/#core_setting-nam...
Aki
On 12/11/2024 07:12, Sirius via dovecot wrote:
On Tue, 2024/11/12 at 03:45:57 +0100, Ralph Seichter via dovecot wrote: DATESTR=$(date --date='TZ="UTC" 0 2 week ago' +'%d-%b-%Y') doveadm expunge -u <user> mailbox Trash before ${DATESTR}
I'm new to Dovecot. I've seen a few examples on the internet like this and I am wondering what is the advantage of this format of the command over one of these:
doveadm expunge -u <user> mailbox Trash before 14d
doveadm expunge -u <user> mailbox Trash before 2w
It seems relatively complicated to manipulate date strings compared to using d or w operators.
On Tue, 2024/11/12 at 10:11:00 +0000, Nick Howitt via dovecot wrote:
On 12/11/2024 07:12, Sirius via dovecot wrote:
On Tue, 2024/11/12 at 03:45:57 +0100, Ralph Seichter via dovecot wrote: DATESTR=$(date --date='TZ="UTC" 0 2 week ago' +'%d-%b-%Y') doveadm expunge -u <user> mailbox Trash before ${DATESTR}
I'm new to Dovecot. I've seen a few examples on the internet like this and I am wondering what is the advantage of this format of the command over one of these:
doveadm expunge -u <user> mailbox Trash before 14d doveadm expunge -u <user> mailbox Trash before 2w
It seems relatively complicated to manipulate date strings compared to using d or w operators.
:-D
Simply because I did not know you could to "before 2w". Looking in the documentation I found relatively fast what the actual date format had to be and I knew 'date' could be used to generate the correct date string for a time in the past. Once you have a tried and tested way that works, you might not look deeper for other ways to do things, because the way you have works.
Now I know you can do it the way you list, so that would be how I do it in the future.
-- Kind regards,
/S
participants (5)
-
Aki Tuomi
-
Hua Young
-
Nick Howitt
-
Ralph Seichter
-
Sirius