• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

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