Removing mails from the Junk folder etc.
Removing mails from the Junk folder etc.
I want to create this into the cron.daily on my vestacp ubuntu 14.04 server
I found this script which could help me out and looks good, but I can't figure out how to change the path to clean/ remove all mails from the Trash folder on each domain.
I guess I have to change the /var/vmail/ of cause, but to what? The exact path looks something like this: /home/$user/mail/$domain/$mailaccount/.Trash/cur/
Then there will be /new/ as well.
I want to use this script and run it automatically once per day as already mentioned.
Anyone could help me with the correct path?
I found this script which could help me out and looks good, but I can't figure out how to change the path to clean/ remove all mails from the Trash folder on each domain.
Code: Select all
#!/bin/sh
# Time to wait before removing mails from the Junk folder (Default: 7 days) Set 0 to turn off.
junk_max_hours=$((24*7))
# Time to wait before removing mails from the Trash folder (Default: 30 days) Set 0 to turn off.
trash_max_hours=$((24*60))
for domain in /var/vmail/*
do
if [ -d "$domain" ]
then
for user in $domain/*
do
if [ "$junk_max_hours" -gt "0" ]
then
if [ -d "$user/.Junk" ]
then
tmpreaper -m $junk_max_hours $user/.Junk/cur
tmpreaper -m $junk_max_hours $user/.Junk/new
fi
fi
if [ "$trash_max_hours" -gt "0" ]
then
if [ -d "$user/.Trash" ]
then
tmpreaper -m $trash_max_hours $user/.Trash/cur
tmpreaper -m $trash_max_hours $user/.Trash/new
fi
fi
done
fi
done
Then there will be /new/ as well.
I want to use this script and run it automatically once per day as already mentioned.
Anyone could help me with the correct path?
Re: Removing mails from the Junk folder etc.
Anyone could guide me in the right direction with this issue?