Script to prune mailbox zimbra?
-
Hi,
I was wondering if someone else has had the same dilemma, so currently i have postfix email server which im moving to zimbra.On my postfix server i had this script that would clean 90 days of emails
#!/bin/bash /usr/bin/find /home/in/Maildir/cur -type f -mtime +90 -delete -name "*.mail.mydomain.com:2" /usr/bin/find /home/in/Maildir/cur -type f -mtime +90 -delete -name "*.mail.mydomain.com:2,S" /usr/bin/find /home/in/Maildir/cur -type f -mtime +90 -delete -name "*.mail.mydomain.com"
and this script to clean the other mailboxes
#!/bin/bash MAILDIRS=$(find /home/*/Maildir/ -maxdepth 0 -type d) for basedir in $MAILDIRS; do for dir in .Trash .Junk .Spam .Low\ Priority; do for dir2 in cur new; do [ -e "$basedir/$dir/$dir2" ] && ( echo "Processing $basedir/$dir/$dir2..." find "$basedir/$dir/$dir2/" -type f -mtime +90 -delete ) done done done
I also saw an option on zimbra about retention policy but i think its not automatic as it needs user permission manually?
or am i wrong?I was looking around but i found a few scripts for zimbra but it deletes amounts of email but not by time
Thank you
-
You can setup the setting on the Admin GUI and it will be done automatically as below
Under Home > Configure > Class of Service → COS → Advanced and scroll down to the Email Retention Policy, it can be per user or per domain.
https://zimbra.github.io/adminguide/latest/#_managing_features_and_settings_with_a_cos
-
Thank you for the reply, but i only need to purge 2 email boxes of the inbox, i went to the user mailbox on the admin and on advance i found this i check on the purge interval and got this
zimbra@mail:/root$ zmprov gacf | grep zimbraMailPurgeSleepInterval zimbraMailPurgeSleepInterval: 1m
So my question is if i activate the email message life time to 90 it means that it will purge emails of that email inbox keeping only 90 days of email?
Thank you
-
@killmasta93 said in Script to prune mailbox zimbra?:
Thank you for the reply, but i only need to purge 2 email boxes of the inbox, i went to the user mailbox on the admin and on advance i found this i check on the purge interval and got this
zimbra@mail:/root$ zmprov gacf | grep zimbraMailPurgeSleepInterval zimbraMailPurgeSleepInterval: 1m
So my question is if i activate the email message life time to 90 it means that it will purge emails of that email inbox keeping only 90 days of email?
Thank you
Yeah, the mailbox will only keep 90 days worth of email.
-
Thank you currently i put 30 days as wont let me add less to test it out i guess have to wait around a few weeks to test it out thank you again