1
0
Fork 0

Add expunge-mailboxes.sh

This commit is contained in:
Tobias Strobel 2021-08-12 17:57:32 +02:00
parent 8a9f082424
commit 721f9596b0
1 changed files with 11 additions and 0 deletions

11
aech/expunge-mailboxes.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
DOVECOTCONTAINERID=`docker ps -qf name=dovecot-mailcow`
# Delete all user's mails in the junk folder that are older than 2 weeks
docker exec ${DOVECOTCONTAINERID} doveadm expunge -A mailbox 'Junk' savedbefore 2w
# Delete all user's mails in the junk folder that are seen and not flagged and older than 72 hours
docker exec ${DOVECOTCONTAINERID} doveadm expunge -A mailbox 'Junk' SEEN not FLAGGED not SINCE 72h
# Delete all user's mails in the trash folder that are seen and not flagged and older than 4 weeks
docker exec ${DOVECOTCONTAINERID} doveadm expunge -A mailbox 'Trash' SEEN not FLAGGED not SINCE 4w