• Inviting everyone who uses WordPress management tools in Plesk
    The Plesk team is conducting a 60-minute research session that includes an interview and a moderated usability test.
    To participate, please use this link .
    Your experience will help shape product decisions and ensure the tools better support real-world use cases.

Plesk saving emails

M

Mark Priest

Guest
Hi All,

I have always had a problem with plesk saving emails. Even if they are not set to save them on the server on the customers machine.

A. How can I stop this

B. How can I remove all emails from the server over x days old
 
You can delete all the files in a dir older than a 30 days with:

find /var/qmail/mailnames/domain.com/username/Maildir/cur/ -name \* -mtime +30
 
Hi Attomic

That's great thanks!

Any way of doing it as a wildcard for say all accounts?
 
Sorry atomicturtle. thats a find command wouldnt you use the rm?
 
This will remove it:

find /var/qmail/mailnames/domain.com/username/Maildir/cur/ -name \* -mtime +30 -exec rm -f {} \;


It would be safer to script something up to do this than to try and condense it all into one line. First off if your users are running IMAP, then you'll have folders under Maildir on each account. The reason you dont want to do this recursively is that there are other files in those dirs you dont want to delete. So maybe something like this to find the dirs:

find /var/qmail/mailnames/ -name cur -type d and follow that up with your deletes. Scripted (rough, untested)

for i in `find /var/qmail/mailnames/ -name cur -type d`; do

find $i -name \* -mtime +30 -exec rm -f {} \;
done
 
Thanks attomic

That's great, it only seems to be a couple of users anyway, probably they have their outlook set up to save for eternity or its corrupt.
 
Back
Top