Question:
Does ListMailboxes always return all the IMAP mailboxes? Or do I need to recurse using references?
To return all mailboxes in the hierarchy, pass arguments as shown here:
// Get the mailboxes. Chilkat.Mailboxes mboxes = imap.ListMailboxes("", "*"); if (mboxes == null) { MessageBox.Show(imap.LastErrorText); return; }
int i; int n = mboxes.Count; for (i=0; i<n; i++) { // Add the mailbox name to a listBox. listBox1.Items.Add(mboxes.GetName(i)); }
The two arguments to the ListMailboxes method are passed directly to the IMAP server. Therefore, the method behaves exactly as specified by the IMAP RFC 3501. (The section of the RFC is duplicated in the Chilkat reference documentation for the ListMailboxes method.)