Skip to content

Commit

Permalink
can now get number of messages in a sub-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewiscowles1986 committed May 23, 2015
1 parent 6a6d909 commit 397b748
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Fetch/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,18 @@ protected function setImapStream()
/**
* This returns the number of messages that the current mailbox contains.
*
* @param string $mailbox the mailbox path if required to get sub-folder counts
* @return int
*/
public function numMessages()
public function numMessages( $mailbox='' )
{
return imap_num_msg($this->getImapStream());
$oldMailbox = $this->getMailBox();
if( $mailbox !== '' ) {
$this->setMailbox( $mailbox );
}
$cnt = imap_num_msg($this->getImapStream());
$this->setMailbox( $oldMailbox );
return $cnt;
}

/**
Expand Down

0 comments on commit 397b748

Please sign in to comment.