如果你的信箱格式是 mbox, 可以試試 archivemail, 請參考:
http://archivemail.sourceforge.net/
可以參考這個自行修改
http://help.directadmin.com/item.php?id=433
#!/bin/sh
#Deletes emails older than this number of days
OLD_THAN_DAYS=30
for i in ls /usr/local/directadmin/data/users
; do
{
if [ ! -d /home/$i/Maildir ]; then
continue;
fi
for file in find /home/$i/Maildir -mtime +${OLD\_THAN\_DAYS} | grep -E '/cur/|/new/'
; do
{
rm -fv $file;
};
done;
};
done;
exit 0;