$ 0 0 Giving the range is a limitation of the IMAP protocol. Which IMAP server are you using? The query works fine for me on GMail.