On Thu, 13 Jun 2002, Lefteris Chatzibarbas wrote:
> Is there a limit on how many searching criteria may be specified
> on an IMAP4rev1 SEARCH command?

The limit is not on how many criteria, but rather on the depth of the
criteria.

Each OR effectively takes you down a level of nesting.  That is:

        OR (FROM "a") OR (FROM "b") OR (FROM "c") (FROM "d")
is effectively
        OR (FROM "a") (OR (FROM "b") (OR (FROM "c") (FROM "d")))

UW imapd declines to accept nesting more than 50 deep.  Instead of nesting
50 deep, you could OR two groups that nest 25 deep and get the same
effect.

By the way, the parens in your search specification were unnecessary, but
they did add an extra level of depth.  In the above example, you'd get the
same result from
        OR FROM "a" OR FROM "b" OR FROM "c" FROM "d"
but the maximum depth would be 1 less.

However, I don't think that's what you really want to do.  It looks to me
as if you are looking for messages with non-empty FROM and TO.  In that
case,
        tag SEARCH OR FROM "" TO ""
will accomplish what you want with much less trauma.

Then again, it should be noted that there is no such thing in the Internet
email specification as an empty FROM, and most MTAs will ensure a
non-empty From: header, generally taking it from the SMTP originator or
"MAILER-DAEMON" as a last resort.  Thus, in effect,
        tag SEARCH TO ""
is all you really need.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.

Reply via email to