I am looking for a way to search across all IMAP folders on my mail server. I recently discovered the IMAP ESEARCH command, which extends the usual SEARCH command to search across folders. I cannot, however, seem to make it work.
I have checked that the mail server supports ESEARCH
. After telnet-ing in, I executed the following:
* OK JAMES IMAP4rev1 Server Server server-address is ready.
A1 LOGIN test test
A1 OK LOGIN completed.
A2 CAPABILITY
* CAPABILITY SASL-IR IDLE LITERAL+ AUTH=PLAIN CONDSTORE ESEARCH CHILDREN UIDPLUS UNSELECT WITHIN ENABLE I18NLEVEL=1 SEARCHRES IMAP4rev1 NAMESPACE QRESYNC
A2 OK CAPABILITY completed.
A3 LIST "" "*"
* LIST (\HasNoChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "Drafts"
* LIST (\HasNoChildren) "." "Sent"
* LIST (\HasNoChildren) "." "Trash"
A3 OK LIST completed.
Note the presence of ESEARCH
. I then tried the following ESEARCH
, which fails.
A4 ESEARCH IN (mailboxes "INBOX") unseen
A4 BAD failed. Unknown command.
An ordinary search works fine:
A5 SELECT INBOX
* FLAGS (\Answered \Deleted \Draft \Flagged \Seen)
...
A5 OK [READ-WRITE] SELECT completed.
A6 SEARCH UNSEEN
* SEARCH 3
A6 OK SEARCH completed.
From what I can read of the spec and the formal syntax this should work. Any help or pointers would be much appreciated.