barbushin/php-imap — pull request #62 by mean-cj (2014-09-03 14:24:30+00:00)
Title: Add Gets listing the folders

/**
* Gets listing the folders
*
* This function returns an object containing listing the folders.
* The object has the following properties: messages, recent, unseen, uidnext, and uidvalidity.
*
* @return array listing the folders
*/

public function getListingFolders() {
$folders = imap_list($this->getImapStream(), $this->imapPath, "*");
foreach ($folders as $key => $folder)
{
$folder = str_replace($this->imapPath, "", imap_utf7_decode($folder));
$folders[ $key ] = $folder;
}
return $folders;
}