I'm getting a BAD...
error when running a LIST
command against an IMAP server that I'm not understanding and could use some help with. I run almost an identical command just prior to it to list the root mailboxes and have no problem, but then as I begin to iterate over those mailboxes and try to list their child mailboxes, I get the error. The odd thing is that even though the first returned line from the IMAP server is the BAD...
response, it still fulfills the rest of the query as if nothing was wrong?!?!
To start off, you'll need to know the namespace
details of the server in question...
NAMESPACE
Array
(
[0] => * NAMESPACE (("" ".")) NIL NIL
)
This server uses an empty root namespace, and a period (.
) for the mailbox delimiter.
Here's the command I'm using for the root list...
LIST "" "%" RETURN (SUBSCRIBED CHILDREN SPECIAL-USE STATUS (MESSAGES UNSEEN))
For which I get the expected response...
Array
(
[0] => * LIST (\Subscribed \HasChildren) "." Archives
[1] => * STATUS Archives (MESSAGES 0 UNSEEN 0)
...
)
I should mention that all of the RETURN
meta capabilities were established from an earlier CAPABILITIES
request.
So based on the results, I begin to iterate over them to get the child mailboxes, with the first one being Archives
. The syntax I'm using is based almost identically to that outlined in the RFC 3501 #6.3.8 examples under LIST
...
LIST "Archives." "%" RETURN (SUBSCRIBED CHILDREN SPECIAL-USE STATUS (MESSAGES UNSEEN))
I would expect it to list all of the child mailboxes relative to the Archives
mailbox, which it does, however it first lists a BAD...
response...
Array
(
[0] => * BAD Error in IMAP command : Unknown command (0.000 + 0.000 secs).
[1] => * LIST (\Subscribed \HasNoChildren) "." Archives.2017
[2] => * STATUS Archives.2017 (MESSAGES 0 UNSEEN 0)
[3] => * LIST (\Subscribed \HasNoChildren) "." Archives.2016
[4] => * STATUS Archives.2016 (MESSAGES 192 UNSEEN 0)
[5] => * LIST (\Subscribed \HasNoChildren) "." Archives.2019
[6] => * STATUS Archives.2019 (MESSAGES 1 UNSEEN 0)
)
First, I don't understand what I've done wrong, and further, the BAD...
error is not referencing a specific command like it should, so I really don't have anything to go on here. Second, if it's failing, then why is it still completing the rest of the request?
Could really use some help, thanks!
EDIT 1: I'm getting this same unexplained error from two different IMAP servers I'm testing against, and they're both exhibiting the same behaviour... returning the correct records, but not before including a BAD...
error first. So it must be something in the syntax of my LIST...
requests, but I feel like I'm using the same examples that the RFC defines, so I'm at a loss.
0 Answers