Difference between revisions of "HowTos/Email Cleanup"
m |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Scalix Wiki]] -> [[How-Tos]] -> '''Email Cleanup''' | ||
+ | |||
==Email cleanup Script== | ==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. | 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. | ||
Line 10: | Line 12: | ||
omtidyu -B -u "$username" -T f -l "Junk E-mail" -d -k -c -a 4 | omtidyu -B -u "$username" -T f -l "Junk E-mail" -d -k -c -a 4 | ||
done | done | ||
− | When done, save it and mark it as executable to all: | + | When done, save it and mark it as executable to all, and have it run daily: |
chmod +x cleanjunk | 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. | 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. | 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 |
Latest revision as of 04:07, 18 January 2007
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