Skip to content

Dovecot

move / delete files on server Maildirs

https://unix.stackexchange.com/questions/217057/can-i-delete-or-move-mail-files-from-maildir-cur-folder

Yes, you may delete files from that folder manually. Dovecot is designed to assume that other software besides itself might manipulate the Maildir folder, including adding, removing, and renaming (the portion of the filename after the colon). It will update the indices accordingly as soon as it notices.

doveadm

doveadm tool

Search:

Examples:

doveadm search -u sysop_mail MAILBOX status BEFORE 01-Jan-2019

Remove all mails older than 1y from all mailboxes of user sysop_mail and bounces:

doveadm batch -u sysop_mail : expunge MAILBOX \* BEFORE 4w : purge
doveadm batch -u bounces : expunge MAILBOX \* BEFORE 4w : purge