If mistakenly I sent a email to all users and I want to delete it from the all users since its a wrong email for something. is there anyway to delete particular subject email from all email users within my domain. I have access to email server. I found below script, but its not working. Can anyone help me on this. (https://wiki.zimbra.com/index.php?title ... he_Subject)
Code: Select all
#!/bin/bash
# rm_message.sh user@domain.com subject
if [ -z "$2" ]; then
echo "usage: rm_message.sh user@domain.com <subject>"
exit 0
else
addr=$1
subject=$2
echo "Searching $addr for Subject: $subject"
for msg in `zmmailbox -z -m "$addr" s -l 999 -t message "subject:$subject"|awk '{ if (NR!=1) {print}}' | grep -v -e Id -e "-" -e "^$" | awk '{ print $2 }'`
do
echo "Removing "$msg""
zmmailbox -z -m $1 dm $msg
done
fi