scripts/aech/expunge-mailboxes.sh

12 lines
623 B
Bash
Raw Permalink Normal View History

2021-08-12 15:57:32 +00:00
#!/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