On Wed, 2011-12-07 at 19:56 -0800, Joseph Tam wrote:
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' ... | \
Oh, you meant this.
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.
Yeah, but it's more effort to remove it than to keep it as it is :) Also a "search" is somewhat simpler and prettier to use.