Delete spam message in all mailbox easily ?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
rokoyato
Advanced member
Advanced member
Posts: 86
Joined: Mon Jun 29, 2020 9:12 am

Delete spam message in all mailbox easily ?

Post by rokoyato »

Hi,

Is there a fast and proper way to delete a message in all account ?

I'm used to a script like this one :

Code: Select all

#!/bin/bash
for acct in $(zmprov -l gaa) ; do 
        echo "Searching "$acct""
        for msg in $(zmmailbox -z -m "$acct" s -l 999 -t message "From:account date:theDate subject:theSubject" | awk 'NR > 4 {print $2}');
          do
        echo -e "Removing "$msg" from "$acct"\n"
        zmmailbox -z -m $acct dm $msg
        zmmailbox -z -m $acct -A ddi $msg
        done
done

This is really slow and does no check all folders (If you do not specify explicitly "in:trash" then the script does not check the trashbin)

Is there a way to properly delete the message ? Does anyone has a faster script ?

Regards
Post Reply