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

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 08-28-2008, 08:17 AM
Senior Member
 
Posts: 62
Default [SOLVED] CLI to enumerate all messages in a folder

I need to enumerate all of the messages in a folder via the CLI. So
far it seems querying MySQL is the only way. I hope I've misread the
"zmmailbox help" options and someone can show me a better way.

How far I got via CLI:

Get my folders (please ignore Contacts/Messages mix I'm working on that):

[zimbra@zstore1 import]$ zmmailbox -z -m fultonj getAllFolders | grep -i contact
7 cont 0 6 /Contacts
38012 mess 0 0 /ContactsTest
13 cont 0 74 /Emailed Contacts
64489 mess 0 52 /ITS Contacts
112975 mess 0 72 /santillr_contacts
[zimbra@zstore1 import]$

Want to getMessage for each message in folder 112975. I can see folder
data:

[zimbra@zstore1 import]$ zmmailbox -z -m fultonj getFolder 112975
{
"id": "112975",
"name": "santillr_contacts",
"path": "/santillr_contacts",
"parentId": "1",
"flags": null,
"color": "defaultColor",
"unreadCount": 0,
"messageCount": 72,
"view": "message",
"url": null,
"effectivePermissions": null
}
[zimbra@zstore1 import]$

but I can't seem to get a list of messages IDs from the folder that I
would then call getMessage with. Tried the following:

[zimbra@zstore1 import]$ zmmailbox -z -m fultonj searchConv 112975 %
ERROR: mail.NO_SUCH_CONV (no such conversation: 112975)
[zimbra@zstore1 import]$ zmmailbox -z -m fultonj searchConv 112975 ''
ERROR: mail.QUERY_PARSE_ERROR (Couldn't parse query: conv:"112975" ())
[zimbra@zstore1 import]$

The closest related forum posts I could find were:

http://www.zimbra.com/forums/install...x-folders.html
Delete un-read email older the X days
Folder Backup - How to get a clean list of all folders but the shared ones

No luck. Please help. Thank you.
Reply With Quote
  #2 (permalink)  
Old 08-28-2008, 09:13 AM
Senior Member
 
Posts: 62
Default

The command I wanted was:

zmmailbox -z -m fultonj search -l 72 "in:santillr_contacts"

Note that I use 72 since that is the messageCount returned by getFolder. If this number isn't specified then I get the default of 25 at a time.
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.