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 Search this Thread Display Modes
  #1 (permalink)  
Old 11-10-2009, 11:33 AM
New Member
 
Posts: 4
Default grep folder contents

I need to search through all the emails in a certain folder for a text string and print the results to a file. On a standard Postfix setup each user would have a /var/spool/mail/username file which I could grep through to accomplish this. How might I do this with Zimbra?

thanks,

--charlie
Reply With Quote
  #2 (permalink)  
Old 11-11-2009, 12:29 PM
Moderator
 
Posts: 1,147
Default

The mail store folder for Postfix in Zimbra is /opt/zimbra/store

An accounts mailbox ID can be found using the following command:
Code:
zmprov gmi user@domain.com
Reply With Quote
  #3 (permalink)  
Old 11-11-2009, 06:54 PM
Outstanding Member
 
Posts: 708
Default

Also try zmmailbox -z -m USER "search -t message 'in:inbox secretword'"

For multiple mailboxes, you can save java startup overhead by piping multiple commands to zmmailbox -z. "sm USER" to set context.

zmmailbox advantages: uses zimbra indices, so may be faster. Aware of folder structure (there is no way to grep just a certain folder, since folder assignment lives in mysql). Less hacking needed. Finds text that might be obscured by html, quoted-printable, or base64 encoding.

grep advantages: It's what you know now, and can be used in more creative pipelines. grep supports regular expressions. Due to a design limitation, zmmailbox can't even handle "multiword phrases".
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.