Added a method to get the current mailbox and modified the visibility of getServerString to be able to get more information about the server.

This commit is contained in:
Roger Llopart Pla 2012-09-18 12:25:55 +02:00
parent 812e4eb048
commit 35e80edaf3
2 changed files with 22 additions and 2 deletions

15
fetchtest.php Normal file
View File

@ -0,0 +1,15 @@
<?php
require 'src/Fetch/Server.php';
require 'src/Fetch/Message.php';
require 'src/Fetch/Attachment.php';
$server = new \Fetch\Server('imap.gmail.com', 993);
$server->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";
}

View File

@ -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();