Skip to content
Nosce Te Ipsum
  • Home
  • About me
  • My COETAIL Blogs
    • Course 1
    • Course 2
    • Course 3
    • Course 4
  • Testimonials
    • Professional
    • Personal
Site Search

batch delete emails from zimbra mailboxes

  • March 21, 2012March 21, 2012
  • by Muhammad
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest
Share on Reddit
Reddit
Email this to someone
email
Share on StumbleUpon
StumbleUpon
Digg this
Digg

If you wish to delete a specific email from all mailboxes in your Zimbra server there is a script which can search mailboxes one by one, starting alphabetically i.e. usernames with numbers first, for this email based on sender’s email address and the subject line. The script runs at speed of about 30-40 mailboxes per minute.

Remember you need to su – zimbra before you run this script.

The code in script is:


#!/bin/bash
# rm_msg.sh user subject
if [ -z "$2" ]; then
echo "usage: rm_msg.sh "
echo " Rummages through all mail boxes looking for messages from with subject="
echo " Example: ./rm_msg.sh butthead_user rems "
echo " Put double-quotes around multi-word subjects"
exit 0
else
addr=$1
subject=$2
for usractnopac in `zmprov -l gaa`
do
echo "Searching $usractnopac for Subject: $subject From: $addr"
for msg in `zmmailbox -z -m "$usractnopac" s -l 999 -t message "is:anywhere from:$addr subject:$subject"|awk '{ if (NR!=1) {print}}' |
grep -v -e Id -e "-" -e "^$" | awk '{ print $2 }'`
do
echo "Removing "$msg""
zmmailbox -z -m $usractnopac dm $msg
done
done
fi

Taken from Zimbra Support Forums

Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest
Share on Reddit
Reddit
Email this to someone
email
Share on StumbleUpon
StumbleUpon
Digg this
Digg
clean mail queue with Perl Script
Installing and Running MinecraftEdu on Linux
Muhammad
batch delte emails remove Zimbra

Related articles

Automating creation of account through…
Zimbra LDAP mapping
Zimbra handy guide
Spamassassin rules

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Me!

Follow Me On TwitterFollow Me On LinkedInFollow Me On PinterestFollow Me On About.meFollow Me On Wordpress
May 2025
M T W T F S S
« Oct    
 1234
567891011
12131415161718
19202122232425
262728293031  

2009 2010 2011 Amelie apache beijing birthday clearos crèpes debian december 2009 dubai email february firewall guide holidays ill install internet kuala lumpur linux list mac maheen mobile october 2009 outlook Pakistan raspberry raspberry pi router search Sharepoint smtp snow spring ubuntu unix VLAN VPN windows 7 winter xian Zimbra

WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.

Categories

Licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Theme by Colorlib Powered by WordPress
  • Home
  • About me
  • My COETAIL Blogs
  • Testimonials