scripts/aech/expunge-mailboxes.sh

11 lines
623 B
Bash

#!/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