HowTos/Email Cleanup
Scalix Wiki -> How-Tos -> Email Cleanup
Email cleanup Script
This script allows you to automatically delete any items older than x many days in any/all of your users folders automatically. I use it to automatically delete any email that is in their "Junk E-mail" folder that is older than 4 days.
Just copy this into a new file, I named mine 'cleanjunk'
#!/bin/bash omshowu -m all | egrep -v 'sxadmin|sxqueryadmin' | while read username do echo "Processing User $username" omtidyu -B -u "$username" -T f -l "Junk E-mail" -d -k -c -a 4 done
When done, save it and mark it as executable to all, and have it run daily:
chmod +x cleanjunk cp cleanjunk /etc/cron.daily
Note that this will only work for top-level folders in the users mailbox. You can look through the man pages for omtidyu ( man omtidyu ) to see all the different options, including how to have it empty out subfolders as well.
This does, of course, expect that all users have their junkmail in a common folder in their mailbox, preferably done via a server-side mail-filter rule.
Original script by Mito