go to bug id or search bugs for
From manual page: http://www.php.net/function.imap-open
My understanding of Mail technologies, MTA, MTU, POP3, IMAP, etc. is that an email (say firstname.lastname@example.org) is associated with a single mailbox, which can be at any given time associated with a single folder, say INBOX or Drafts, but only INBOX in the case of a mail delivery agent (MDA). So, INBOX, etc. are folders, not mailboxes. I know that implementations of IMAP servers and the associated RFCs, refer to these folders as mailboxes. However, Gmail, Mozilla in the context of Thunderbird, Microsoft Windows in the context of Outlook, Wikipedia in the context of email clients, etc. use the term IMAP folders when they refer to INBOX, etc. It is unfortunate that the PHP IMAP client implementation followed the naming convention used in IMAP servers and associated RFCs. So, I feel a clarification for those who expect the more natural and largely spread convention is necessary.
However, there is a lot more in this documentation bug than only a naming convention. In what follows I use the PHP imap convention. An email or mailbox stream can be associated with a different selected mailbox at any given time. This is a fundamental concept in the understanding of an IMAP client. When we call imap_open, we do not open a mailbox (folder), but an entire mailbox stream with its associated hierarchy of mailboxes and we also select the current mailbox at the same time. So, imap_open() does two things: open a mailbox stream and select the current mailbox. This is not well explained in the documentation.
In fact, it seems to have it wrong. The documentation in imap_list() and perhaps elsewhere adds to the confusion. The function imap_list() takes two arguments (+ a third for a pattern) : the first is the mailbox stream and the second is a mailbox in the hierarchy, **which does not have to be the selected mailbox.** This makes sense because this function does not need the details of the selected mailbox, so it ignores it. There are many other imap functions that ignores the selected folder for the same reason. The documentation in imap_list() and perhaps in other similar functions is wrong and fails to convey this basic understanding because it says explicitly that the second argument should normally be the selected folder given in imap_open(). This misses the basic point. It's a fundamental misunderstanding.
Add a Patch
Add a Pull Request
I changed the summary. The confusion is between mailbox streams and mailboxes as folders. In imap_open() and imap_reopen(), we select a mailbox as a folder. However, in imap_list() and other imap functions, we provide a sub mailbox stream - we are not interested in its folder aspect, the details of its content - we cannot delete, etc, which can only be done in the selected mailbox (folder).
I realize that there were two issues in this bug report : the naming convention needs to be explained and the description of the argument ref in imap_list is too restrictive. So, I created a separate bug report for this second issue.