#!/bin/bash | |
# rm_message.sh user@domain.com subject | |
# create temp_file prior to calling this zmprov -l gaa | grep domain.com > /tmp/temp_email | |
if [ -z "$2" ]; then | |
echo "usage: rm_message.sh user@domain.com <subject>" | |
exit 0 | |
else | |
addr=$1 | |
subject=$2 | |
for acct in `cat /tmp/temp_email` ; do | |
echo "Searching $acct for Subject: $subject" | |
for msg in `/opt/zimbra/bin/zmmailbox -z -m "$acct" s -l 999 -t message "from:$addr subject:$subject"|awk '{ if (NR!=1) {print}}' | grep -v -e Id -e "----" -e "^$" | awk '{ print $2 }'` | |
do | |
echo "Removing "$msg" from "$acct"" | |
/opt/zimbra/bin/zmmailbox -z -m $acct dm $msg | |
done | |
done | |
fi |
This comment has been minimized.
This comment has been minimized.
!/bin/bashrm_message.sh user@domain.com subject"get message subject :" zmmailbox -z -m user@domain.com s -t message -l 50 "in:inbox date:mm/dd/yyyy"create temp_file prior to calling this zmprov -l gaa | grep domain.com > /tmp/temp_emailif [ -z "$2" ]; then |
This comment has been minimized.
This comment has been minimized.
This is what working for my zimbra Release 8.5.0.GA.3042
|
This comment has been minimized.
This comment has been minimized.
Works on 8.7
|
This comment has been minimized.
This comment has been minimized.
this doesn't work if the Subject contains a "-" character. Must edit the script line from |
This comment has been minimized.
This comment has been minimized.
Thanks, will update. This worked for me on the older zimbra 7 server |
This comment has been minimized.
This comment has been minimized.
How about removing an email only by subject without specifying the sender addr? |
This comment has been minimized.
This comment has been minimized.
the script seems not to be working on zimbra version 9 |
This comment has been minimized.
Updated a script found on the zimbra wiki for task, think it's a handy thing to have.