Skip to content

Instantly share code, notes, and snippets.

@laztname
Last active June 29, 2021 02:17
Show Gist options
  • Save laztname/91caba04b7f6db03eff8c4e9566986b9 to your computer and use it in GitHub Desktop.
Save laztname/91caba04b7f6db03eff8c4e9566986b9 to your computer and use it in GitHub Desktop.
zimbra remove spam for all accounts in inbox
# remove spam / phising in all account inbox
# modified from https://github.com/Ghosto27/Zimbra_remover/blob/master/rm_message.sh
# for victim in $(cat list); # list of victims gathered from mail gateway or just
for victim in $(zmprov -l gaa); # for all account in mail server
do
echo "=======Looking for "$victim""
#instead "From:$subject" you can use "subject:$subject" or something another or using content
for msg in `zmmailbox -z -m "$victim" s -l 500 -t message "content:(\"pending incoming messages\")" | awk '{ if (NR!=1) {print}}' | grep -v -e Id -e "-" -e "^$" | awk '{ print $2 }'`
do
echo "Found "$msg""
#you can comment next line (#) for ONLY check mails, without deleting
zmmailbox -z -m $victim dm $msg
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment