Hi everybody !
We are using Zimbra 8.0.9 ,
We look forward to having a feature that can help remove or move old emails to the trash !
Ex : Move to trash emails from "mmm/ddd/yyy" to "mmm/ddd/yyy"
What can I do ?
Thank you very much,
Best regards,
Vuducanha2
How to delete old mails by date
- DualBoot
- Elite member
- Posts: 1326
- Joined: Mon Apr 18, 2016 8:18 pm
- Location: France - Earth
- ZCS/ZD Version: ZCS FLOSS - 8.8.15 Mutli servers
- Contact:
Re: How to delete old mails by date
Hello,
you can use filter or upgrade to 8.6 to get advantage of retention policy.
See you
you can use filter or upgrade to 8.6 to get advantage of retention policy.
See you
- pup_seba
- Outstanding Member
- Posts: 687
- Joined: Sat Sep 13, 2014 2:43 am
- Location: Tarragona - Spain
- Contact:
Re: How to delete old mails by date
Hi,
You could always try to script it. The one below would work for items in dumpster. Consider that the maximum amount of items per search result is limited to 1.000. You could try to adapt the script to scan all folders on each account (i guess you would have to nest another for loop this time with a "gaf (get all folders)" maybe?. It will be quite a slow script to execute btw...
Regarding retention policy, what DualBoot suggests makes a lot of sense. I don't have access to a 8.0.9 right now, but I could swear that the option is available there. Could you check it?
"
#!/bin/bash
AGE=30d
for account in `zmprov -l gaa`;
do
echo "$account"
zmmailbox -z -m $account s --dumpster -l 1000 --types message before:-$AGE | sed '/^$/d' | awk 'FNR>3 {print "dumpsterDeleteItem " $2}' > /tmp/$account.$$
if [ -f /tmp/$account.$$ ] & [ -s /tmp/$account.$$ ] ; then
COUNT=`wc -l /tmp/$account.$$ | awk '{print $1}'`
echo "$account: deleting $COUNT emails from dumpster"
zmmailbox -z -m $account -A < /tmp/$account.$$;
else
echo "$account: no emails found"
fi
rm -f /tmp/$account_msgs.$$
done
"
Please, don't go wild with this script...test it carefully in a test enviroment as it will remove things from users mailboxes.
Regards,
You could always try to script it. The one below would work for items in dumpster. Consider that the maximum amount of items per search result is limited to 1.000. You could try to adapt the script to scan all folders on each account (i guess you would have to nest another for loop this time with a "gaf (get all folders)" maybe?. It will be quite a slow script to execute btw...
Regarding retention policy, what DualBoot suggests makes a lot of sense. I don't have access to a 8.0.9 right now, but I could swear that the option is available there. Could you check it?
"
#!/bin/bash
AGE=30d
for account in `zmprov -l gaa`;
do
echo "$account"
zmmailbox -z -m $account s --dumpster -l 1000 --types message before:-$AGE | sed '/^$/d' | awk 'FNR>3 {print "dumpsterDeleteItem " $2}' > /tmp/$account.$$
if [ -f /tmp/$account.$$ ] & [ -s /tmp/$account.$$ ] ; then
COUNT=`wc -l /tmp/$account.$$ | awk '{print $1}'`
echo "$account: deleting $COUNT emails from dumpster"
zmmailbox -z -m $account -A < /tmp/$account.$$;
else
echo "$account: no emails found"
fi
rm -f /tmp/$account_msgs.$$
done
"
Please, don't go wild with this script...test it carefully in a test enviroment as it will remove things from users mailboxes.
Regards,
-
- Posts: 8
- Joined: Wed Nov 07, 2018 9:18 am
Re: How to delete old mails by date
Thanks Bropup_seba wrote:Hi,
You could always try to script it. The one below would work for items in dumpster. Consider that the maximum amount of items per search result is limited to 1.000. You could try to adapt the script to scan all folders on each account (i guess you would have to nest another for loop this time with a "gaf (get all folders)" maybe?. It will be quite a slow script to execute btw...
Regarding retention policy, what DualBoot suggests makes a lot of sense. I don't have access to a 8.0.9 right now, but I could swear that the option is available there. Could you check it?
"
#!/bin/bash
AGE=30d
for account in `zmprov -l gaa`;
do
echo "$account"
zmmailbox -z -m $account s --dumpster -l 1000 --types message before:-$AGE | sed '/^$/d' | awk 'FNR>3 {print "dumpsterDeleteItem " $2}' > /tmp/$account.$$
if [ -f /tmp/$account.$$ ] & [ -s /tmp/$account.$$ ] ; then
COUNT=`wc -l /tmp/$account.$$ | awk '{print $1}'`
echo "$account: deleting $COUNT emails from dumpster"
zmmailbox -z -m $account -A < /tmp/$account.$$;
else
echo "$account: no emails found"
fi
rm -f /tmp/$account_msgs.$$
done
"
Please, don't go wild with this script...test it carefully in a test enviroment as it will remove things from users mailboxes.
Regards,
I want to create an event when clicking on the button will have a popup menu, but I am making an error here (stop process in line 60) can you point me to the error,
-
- Posts: 8
- Joined: Wed Nov 07, 2018 9:18 am
Re: How to delete old mails by date
<blockquote class="imgur-embed-pub" lang="en" data-id="a/QeTHHLN"><a href="//imgur.com/QeTHHLN"></a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
Code stop in line 60
Code stop in line 60