King0770-Notes

Revision as of 23:10, 2 July 2008 by King0770 (talk | contribs) (New page: ==Removing Messages with Zmmailbox based on the Subject== <code><pre> #!/bin/bash # rm_message.sh mailto:source.user@do.main subject if [ -z "$2" ]; then echo "usage: rm_message.sh user@...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Removing Messages with Zmmailbox based on the Subject

#!/bin/bash
# rm_message.sh mailto:source.user@do.main 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
Jump to: navigation, search