Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-17-2008, 08:16 AM
Active Member
 
Posts: 43
Default [SOLVED] Batch delete of specific emails in account

Hello everyone!

I have an account that has been the target of a spam attack, with over 22.000 spam emails now in the inbox folder. I am trying to find a way to get a list of all messages, filter them with the usual grep/cut/sed/awk tools and get a list of message IDs that I can, again, batch process with zmmailbox and mark them as junk.

I have found the command to mark them as junk (which will also move them into the junk folder, hopefully), but I have not found a way to list all the emails in a given account/folder so that I can filter them and get the IDs.

Any hints? This is a Debian Etch 32 bits box with ZCS Network Edition 5.0.7 and 1200 accounts from one of my customers.

Thanks in advance.
__________________
Jaume Sabater
http://linuxsilo.net/

"Ubi sapientas ibi libertas"
Reply With Quote
  #2 (permalink)  
Old 09-17-2008, 08:45 AM
Trained Alumni
 
Posts: 54
Default

This is a bit time consuming...but the only way I know of to do this is with zmmboxsearch
Code:
zmmboxsearch -d /tmp/somedir -m account@domain.com -l25000 -q "in:\"Inbox\""
This will dump (-d) the messages that match the query (-q) for the mailbox (-m) with a limit of 25000 results returned.

From there, you will have all the messages in the /tmp/somedir that will be named:
Sequence#_uuid_messageid
So, if you were able to fine-tune the problems with the search, you will have all the message ids to get rid of. Otherwise, you will have all messages that you can then go through w/ normal command-line tools, and then make a list of the message IDs that you want to get rid of.

From that you can then use zmmailbox to operate on the specific message ids. So, if you want to remove items, you can do:
Code:
zmmailbox -z -m account@domain.com di itemid itemid itemid
Reply With Quote
  #3 (permalink)  
Old 09-20-2008, 04:45 AM
Active Member
 
Posts: 43
Default

Thanks for the information. I managed to obtain the dump of messages and then, by a lot of greps, cuts, etc, get the IDs and, finally, process them.

Gotta say that, in the beginning, I was confused and was trying to get it done with the zmmailbox search command, but I could not manage to. Do you know whether this command would do the job that zmmboxsearch did, too?

Thanks for your help. Very much appreciated.
__________________
Jaume Sabater
http://linuxsilo.net/

"Ubi sapientas ibi libertas"
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0