mirror of
https://github.com/retailcrm/Fetch.git
synced 2025-02-06 10:39:21 +03:00
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:
parent
812e4eb048
commit
35e80edaf3
15
fetchtest.php
Normal file
15
fetchtest.php
Normal 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";
|
||||||
|
}
|
@ -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
|
* 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
|
* 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
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getServerString()
|
public function getServerString()
|
||||||
{
|
{
|
||||||
$mailboxPath = '{' . $this->serverPath;
|
$mailboxPath = '{' . $this->serverPath;
|
||||||
|
|
||||||
@ -337,7 +342,7 @@ class Server
|
|||||||
$numMessages = $limit;
|
$numMessages = $limit;
|
||||||
|
|
||||||
if($numMessages < 1)
|
if($numMessages < 1)
|
||||||
return false;
|
return array();
|
||||||
|
|
||||||
$stream = $this->getImapStream();
|
$stream = $this->getImapStream();
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user