How does it use zmmailbox search command?

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
User avatar
evilside
Advanced member
Advanced member
Posts: 62
Joined: Sat Sep 13, 2014 3:24 am
Location: Chile
ZCS/ZD Version: zcs-8.8.15_GA_3918.UBUNTU14_64

How does it use zmmailbox search command?

Post by evilside »

Hi

Could anybody show me examples using the bolded arguments??

zmmailbox help search

search(s) [opts] {query}
-p/--previous previous page of search results
-s/--sort <arg> sort order TODO
-c/--current current page of search results

-t/--types <arg> list of types to search for (message,conversation,contact,appointment,document,task,wiki)
-v/--verbose verbose output
-l/--limit <arg> max number of results to return (1-1000, default=25)
--dumpster search in dumpster
-n/--next next page of search results

I need get message IDs from searches with over 1000 results, I think these arguments could serve me.
damith
Posts: 44
Joined: Sat Sep 13, 2014 3:57 am

Re: How does it use zmmailbox search command?

Post by damith »

Hi evilside,

The following command will help you to get what you want.

zmmailbox -z -m username@example.com s -t message -l 1000 "in:Inbox subject: <subject that you want to search>"

Thanks
Udayanga
User avatar
evilside
Advanced member
Advanced member
Posts: 62
Joined: Sat Sep 13, 2014 3:24 am
Location: Chile
ZCS/ZD Version: zcs-8.8.15_GA_3918.UBUNTU14_64

Re: How does it use zmmailbox search command?

Post by evilside »

Hi damith

Thanks, but I already know how to search. The problem is that I always get 1000 results maximum.

I need to get next page of results, and I think the '-n' argument can do it, but it don't working.
User avatar
pup_seba
Outstanding Member
Outstanding Member
Posts: 687
Joined: Sat Sep 13, 2014 2:43 am
Location: Tarragona - Spain
Contact:

Re: How does it use zmmailbox search command?

Post by pup_seba »

Hi,

I don't think that you can get more than 1.000 results per single search. This is why I always assumed that 1.000 is a limit, not only for what's being displayed, but for how many items can be searched on each execution.

I don't know the answer to your question, but I did in the past used zmmailbox and needed more than 1.000 items (the purging of mailboxes wasn't working, so we had to do it manually). Although I know I'm not answering your question, maybe, part of this little script (zimbra support gave it to me) could help you. The fact that Zimbra support provided this script, where limit is 1.000, "kind of" confirms that one can't get more than 1.000 results per search (otherwise it would be just easier to look once and then "change" to the next page of results I guess), regardless of what the arguments you are asking about do.

#!/bin/bash

# Below define the number of days/months/years to delete dumpster emails. Current is 30d (30 days).
AGE=30d

for account in `zmprov -l gaa`;
do
echo "$account: searching dumpster emails older than $AGE"
zmmailbox -z -m $account s --dumpster -l 1000 --types message before:-$AGE | sed '/^$/d' | awk 'FNR>3 {print "dumpsterDeleteItem " $2}' > /tmp/$account.$$
if [ -f /tmp/$account.$$ ] & [ -s /tmp/$account.$$ ] ; then
COUNT=`wc -l /tmp/$account.$$ | awk '{print $1}'`
echo "$account: deleting $COUNT emails from dumpster"
zmmailbox -z -m $account -A < /tmp/$account.$$;
else
echo "$account: no emails found"
fi
rm -f /tmp/$account_msgs.$$
done
User avatar
evilside
Advanced member
Advanced member
Posts: 62
Joined: Sat Sep 13, 2014 3:24 am
Location: Chile
ZCS/ZD Version: zcs-8.8.15_GA_3918.UBUNTU14_64

Re: How does it use zmmailbox search command?

Post by evilside »

Thanks but that script woking only when the target is to delete messages. After It deleted first 1000 results, is posible to delete the next 1000 results.

I don't want to delete messages, I need copy them from a mailbox to other.

It is strange that exist the -next and -previous parameters, but there is not information about how working.
Post Reply