[Dovecot] doveadm fetch vs search+fetch

Joseph Tam jtam.home at gmail.com
Thu Dec 8 05:56:01 EET 2011


On Thu, 8 Dec 2011, Timo Sirainen wrote:

>> It seems "doveadm fetch" functionally supercedes "doveadm search"
>> making the latter obsolete.  It can even be closely simulated
>> with "doveadm -f tab fetch ... 'mailbox-guid uid' search-query ...".
>
> If you want to fetch message headers/bodies separately for multiple
> messages, then doveadm search is useful. With "doveadm fetch" you can't
> really know where one message ends and another one begins (although the
> ^L character between messages is a good indicator, it's not 100%
> reliable). And in any case it's more difficult to use for separating
> messages in a shell script.

You could use, as I suggested,

 	doveadm -f tab fetch -u bob 'mailbox-guid uid' ... | \
 	while read guid uid; do
 	...
 	done

which pretty much does the same thing (but you have to dump the first
line, ugh!).  It doesn't matter all that much except some extra man
page reading, but it will save you the bother of having to maintain a
separate binary, man page, etc. for what is essentially a duplicate.

Joseph Tam <jtam.home at gmail.com>



More information about the dovecot mailing list