Here is a simple script I use. I think I may have pulled it form here years ago.
Code:
#!/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*30))
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,new}
fi
fi
if [ "$trash_max_hours" -gt "0" ]
then
if [ -d "$user/.Trash" ]
then
tmpreaper -m $trash_max_hours $user/.Trash/{cur,new}
fi
fi
done
fi
done
For spamassassin learning
Code:
#!/bin/sh
/usr/bin/sa-learn --spam /var/vmail/(domain)/.Junk/*/*
Recent comments
6 hours 7 min ago
15 hours 35 min ago
16 hours 24 min ago
19 hours 58 min ago
1 day 22 min ago
1 day 44 min ago
1 day 2 hours ago
1 day 12 hours ago
1 day 17 hours ago
1 day 19 hours ago