Also try zmmailbox -z -m USER "search -t message 'in:inbox secretword'"
For multiple mailboxes, you can save java startup overhead by piping multiple commands to zmmailbox -z. "sm USER" to set context.
zmmailbox advantages: uses zimbra indices, so may be faster. Aware of folder structure (there is no way to grep just a certain folder, since folder assignment lives in mysql). Less hacking needed. Finds text that might be obscured by html, quoted-printable, or base64 encoding.
grep advantages: It's what you know now, and can be used in more creative pipelines. grep supports regular expressions. Due to a design limitation, zmmailbox can't even handle "multiword phrases". |