• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Deleting old mails from the server

Filipe Silva

Basic Pleskian
Greatings everyone.

I'm in the need of a comand to remove emails older than 30 days from the server. (We are using dovecot/postfix)
I found this : "find /var/qmail/mailnames/domain/*/*/cur -type f -mtime +30 -exec rm {} \;" and it works, but the other IT guy says it is too risky, but I can't find a specific dovecot/postfix comand to delete old mails.
The other solution is to violate the users account and delete old emails in the webmail.

What do you recommend?
Thank you.

PS: I am resorting to this because some users are not accessible to properly configure the email client and it is harder to educate them to use webmail to delete older emails.
 
On a first thought I don't get what exactly the risk would be. Each mail is stored as a single file. To my knowledge there is no static index that points to the files, but files are read on-the-fly when the mailbox is opened. If a file is not there, the mail is not there.
 
I see and agree,

However as I research may exist another option with something like "doveadm -expunge".

EDIT: Found it. For whoever is interested:
"doveadm expunge mailbox Inbox savedbefore 30d -u <user>"
 
Last edited:
Back
Top