Automatically delete trash and spam

I have set each virtual server to delete both trash and spam after 8 days in “Server Configuration==>Spam and Virus Delivery”

This used to work fine however for some time now it doesn`t do anything.

What could be the cause?

Can someone give some hint to where to look for to solve the problem?


That is strange… I am not sure what is causing it to not delete the messages. Only thing I could suggest is checking the system logs for any possible error messages. I know on CentOS you can check /var/log/ directory not sure if logs are stored in the same location for other distros sorry.

My approach:
Create a script with the content

find /home////Maildir/cur/ -type f -mtime +60 -exec rm {} ;
find /home/
///Maildir/.Sent/cur/ -type f -mtime +60 -exec rm {} ;
find /home////Maildir/.Drafts/cur/ -type f -mtime +60 -exec rm {} ;
find /home/
///Maildir/.Trash/cur/ -type f -mtime +60 -exec rm {} ;

Run it manually or cron it.
This script deletes any files older that 60 days in those folders.
Increase the number of days to what you need.
Delete lines with folders you don’t want emptied.

Thank you inteq, this works fine. Thought about doing it before but I am not very knowledgeable about linux commands. Done it in terminal and will setup a cron for the future.