Deleting Particular Mail From All Accounts: Difference between revisions
Appearance
Created page with "Following script deletes a particular mail from all accounts. In the script, the subject of the mail is "Re: Annual Performance Appraisal Results: FY 2011-12" and the sender i..." |
No edit summary |
||
| Line 1: | Line 1: | ||
[[Category:Zimbra]] | |||
Following script deletes a particular mail from all accounts. In the script, the subject of the mail is "Re: Annual Performance Appraisal Results: FY 2011-12" and the sender is "narinder.kalia@orientbell.com" | Following script deletes a particular mail from all accounts. In the script, the subject of the mail is "Re: Annual Performance Appraisal Results: FY 2011-12" and the sender is "narinder.kalia@orientbell.com" | ||
| Line 7: | Line 9: | ||
echo "Searching $addr" | echo "Searching $addr" | ||
#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 }'` | #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 }'` | ||
for msg in `zmmailbox -z -m "$addr" s -l 225 -t message 'subject:"Re: Annual Performance Appraisal Results: FY 2011-12" and From:narinder.kalia@orientbell.com' | awk '{ if (NR!=1) {print}}' | egrep -v 'Id|-----|^$ | for msg in `zmmailbox -z -m "$addr" s -l 225 -t message 'subject:"Re: Annual Performance Appraisal Results: FY 2011-12" and From:narinder.kalia@orientbell.com' | awk '{ if (NR!=1) {print}}' | egrep -v 'Id|-----|^$' | awk '{ print $2 }'` | ||
do | do | ||
echo "Removing "$msg"" | echo "Removing "$msg"" | ||
Latest revision as of 05:18, 17 August 2012
Following script deletes a particular mail from all accounts. In the script, the subject of the mail is "Re: Annual Performance Appraisal Results: FY 2011-12" and the sender is "narinder.kalia@orientbell.com"
#!/bin/bash
for i in `cat userlist2`; do
addr=$i
echo ""
echo "Searching $addr"
#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 }'`
for msg in `zmmailbox -z -m "$addr" s -l 225 -t message 'subject:"Re: Annual Performance Appraisal Results: FY 2011-12" and From:narinder.kalia@orientbell.com' | awk '{ if (NR!=1) {print}}' | egrep -v 'Id|-----|^$' | awk '{ print $2 }'`
do
echo "Removing "$msg""
zmmailbox -z -m $i dm $msg
echo "Deleted from $i"
echo ""
done
# fi
done