Link to home
Start Free TrialLog in
Avatar of stuffer
stuffer

asked on

IMAP: How to list an INBOX's sub folders

I have a problem accessing the folders I have created within my INBOX.

At present I have created a numebr of subfolders within my mail box. When I then access the mailbox using the imap functions I can only return the messages stored in the root folder. i.e.

   INBOX
      |
      |- SPAM
      |
      L INFO

I can access all information stored in the root of INBOX but not see or access any messages stored in SPAM or INFO.

I am using the following code:-

<?php

      $mbox = imap_open ("{SERVER:110/pop3}", "MyUserName", "MyPassWord") or die("can't connect: ".imap_last_error());
      
      $list = imap_list($mbox,"{SERVER:110/pop3}","*");
      if(is_array($list))
      {
            reset($list);
            while (list($key, $val) = each($list))
            {
                  print imap_utf7_decode($val)."<br>\n";
            }
      }
      else
            print "imap_list failed: ".imap_last_error()."\n";
      
      $BoxList = imap_getmailboxes($mbox,"{SERVER:110/pop3}","*");
      print_r($BoxList);
      while (list($key, $val) = each($BoxList))
      {
            print "($key) ";
            print imap_utf7_decode($val->name).",";
            print "'".$val->delimiter."',";
            print $val->attributes."<br>\n";
      }       
      imap_close($mbox);
?>

I am using these functions on POP3 and have found that some of the functions dont work as they were written for IMAP. Yet can someone please confirm that either I cant do this or help me out in some way??
ASKER CERTIFIED SOLUTION
Avatar of shmert
shmert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stuffer
stuffer

ASKER

Nope afraid not, nothing is returned again. I will have a word with our Network Admin guy and see if he can convert the mailbox to IMAP.

Cheers for the comment though Shmert.
Avatar of stuffer

ASKER

I have managed to convert the mailboxes to IMAP and had a problem still accessing the mailbox yet found the fault to be the connection details. I still tried connecting on port 110 when IMAP runs over port 143.

Thanks Shmert