Page 1 of 1

How does it use zmmailbox search command?

Posted: Wed Jan 23, 2019 7:57 pm
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.

Re: How does it use zmmailbox search command?

Posted: Fri Jan 25, 2019 2:14 am
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

Re: How does it use zmmailbox search command?

Posted: Fri Jan 25, 2019 5:21 am
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.

Re: How does it use zmmailbox search command?

Posted: Tue Jan 29, 2019 8:23 pm
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

Re: How does it use zmmailbox search command?

Posted: Thu Feb 07, 2019 11:52 pm
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.