diff --git a/aech/expunge-mailboxes.sh b/aech/expunge-mailboxes.sh new file mode 100644 index 0000000..079d073 --- /dev/null +++ b/aech/expunge-mailboxes.sh @@ -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