I am using gmail's IMAP API to search for mails.

I use the 'OR' criteria to search for different keywords. This works well if I go one level only, i.e. something like

'UID SEARCH OR (FROM "somebody@email.com") (TO "somebody@email.com")'

however, it does not work when I try a longer expression like

criteria OR criteria OR criteria or criteria

which translates to (as far as I understand the syntax)

'UID SEARCH OR ( OR (FROM "somebodyelse@email.com") (TO "somebodyelse@email.com")) ( OR (FROM "somebody@email.com") (TO "somebody@email.com"))'

to make it clear I basically want all messages that are either sent from or sent to ANY of a given list of emails

The error I get from the libray is

[ 'A34', 'BAD', 'Could', 'not', 'parse', 'command' ]

any suggestions?

Edit
Report