Auto-clearing not working, is there something else I need to do?

I have set Auto-Clearing to delete emails older than 60 days in the Sent Messages folder. I did this last week, but several days later its not deleted any. Still over 9Gb of emails in there as last week.

So is there some other setting to enable this? When is it supposed to run (daily, weekly?). Does it need a cron entry setup? Or does it it have an issue?


I just tested Auto-clearing on one of my folders and it worked as expected.

I am not sure what initiated the actual deletion but it happened quite soon after I set the Auto-clearing preferences. Interestingly the messages and count in the right Mail panel of Usermin showed the change but the message count next to the folder in the left panel still showed the old count. It required me to reload the panel to see the updated count. I guess the deletion must have occurred when I switched from the Auto-clearing preference page to the mail so the page reloaded then.

I believe that the first time I set the auto-clearing it didn’t update right away but I am not sure how long it took as I left the computer for about an hour to do something else. Just to check I went back in and decreased the number of days to save emails for and when I switched back and looked it hadn’t removed any extras. So there has to be some kind of timed event. I just don’t know what it is. It does not appear to be event driven as I tried selecting different links and logging out and back in and the deletions did not occur.

I checked the Cron jobs for the server and found this one that runs once an hour:

I tried running it manually but it did not delete the additional emails.

open(CONF, “/etc/usermin/miniserv.conf”) || die “Failed to open /etc/usermin/miniserv.conf : $!”;
while() {
$root = $1 if (/^root=(.*)/);
$root || die “No root= line found in /etc/usermin/miniserv.conf”;
$ENV{‘PERLLIB’} = “$root”;
$ENV{‘WEBMIN_CONFIG’} = “/etc/usermin”;
$ENV{‘WEBMIN_VAR’} = “/var/usermin”;
exec("$root/mailbox/", @ARGV) || die “Failed to run $root/mailbox/ : $!”;

I have not done much in Perl so I really don’t know what this does. I’m guessing that it uses the info saved for Auto-clearing and completes the task(s)
I am not sure why it wouldn’t work when I ran it manually (though cron.)

The message deletion just occurred but it was 1 minute before the scheduled cron job so I will assume that the Auto-clearing takes place once per hour based on the time the first job was set up.

If yours is still not working you might want to check the cron job /home/domain/homes/user/.usermin/mailbox/ and see if that is the issue.


What an idiot I am.

I have two domains and

I was testing my Usermin stuff using but viewing the cron job for
It just happened that the creation time of my Auto-clearing setups were just minutes apart.
In fact the cron job ran when it was supposed to and the manual run wasn’t working because I was looking at the wrong mail folder.

Final result: The Auto-clearing works fine. It uses a cron job /home/domain/homes/user/.usermin/mailbox/ which is set up to run once an hour.

Strange, I do not have an file in this mail folder. I have cron jobs and this file in a couple of other folders, but not the one I created the auto clearing for. Maybe thats why its not working, but then it asks the question why it was not created.

The specific cron job I am referring to is in my main server (root) account, not the individual domain account. Are you checking there? I don’t see it if I don’t log in as root.

----------User----------------------Active--------------------Command Yes--------------/home/DomainFolder/homes/user/.usermin/mailbox/

You could try and set up a new one and see if the entry gets added

Yes I am logged in as root so I can see all cron jobs, and there are two referring to that file but for other users. The user in question does not have that file nor has a cron job for it, even though I created auto-clearing for them :frowning:

P.S. thanks for your very in depth explanation thats great!

If you make one and run it let me know if it works.


Edit: I just checked one of my accounts that did not have auto-clearing set up and the file does not exist. I assume it is created when the cronjob is created (when the initial auto-clearing event is created.) Either copy the file to the directory or try deleting the auto-clear event that you made originally and try creating a new one to see if the file gets created as well as the cron job.