From 35e80edaf3f71a3d0d4193d147e0e1550cda7488 Mon Sep 17 00:00:00 2001 From: Roger Llopart Pla Date: Tue, 18 Sep 2012 12:25:55 +0200 Subject: [PATCH] Added a method to get the current mailbox and modified the visibility of getServerString to be able to get more information about the server. --- fetchtest.php | 15 +++++++++++++++ src/Fetch/Server.php | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 fetchtest.php diff --git a/fetchtest.php b/fetchtest.php new file mode 100644 index 0000000..66f39d2 --- /dev/null +++ b/fetchtest.php @@ -0,0 +1,15 @@ +setAuthentication('iskoa.buggenie@gmail.com', '17my3Quqo28JU1yqQR50'); + + +$messages = $server->search('unseen'); +/** @var $message \Fetch\Message */ +foreach ($messages as $message) { + echo "Subject: {$message->getSubject()}\nBody: {$message->getMessageBody()}\n"; +} diff --git a/src/Fetch/Server.php b/src/Fetch/Server.php index 308329a..a84b960 100644 --- a/src/Fetch/Server.php +++ b/src/Fetch/Server.php @@ -161,6 +161,11 @@ class Server } } + public function getMailBox() + { + return $this->mailbox; + } + /** * This function sets or removes flag specifying connection behavior. In many cases the flag is just a one word * deal, so the value attribute is not required. However, if the value parameter is passed false it will clear that @@ -229,7 +234,7 @@ class Server * * @return string */ - protected function getServerString() + public function getServerString() { $mailboxPath = '{' . $this->serverPath; @@ -337,7 +342,7 @@ class Server $numMessages = $limit; if($numMessages < 1) - return false; + return array(); $stream = $this->getImapStream(); $messages = array();