• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

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