Skip to content

Commit

Permalink
KAYAKOC-32013 | oAuth with POP3 does not detect the emails in the mai…
Browse files Browse the repository at this point in the history
…lbox (#2)

* bugfix\KAYAKOC-32013

* add function fwrite

* update indent
  • Loading branch information
fpt-thanhdq2 authored Nov 13, 2022
1 parent 83ce051 commit 379b4b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Protocol/Pop3.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Zend\Mail\Protocol;

use Zend\Stdlib\ErrorHandler;
use function fwrite;

class Pop3
{
Expand Down Expand Up @@ -138,6 +139,29 @@ public function sendRequest($request)
}
}

/**
* Send requests
*
* @param string $requests your request in array
* @throws Exception\RuntimeException
*/
public function sendRequests($requests = [])
{
ErrorHandler::start();
$result = '';
foreach ($requests as $request) {
if (fwrite($this->socket, $request . "\r\n") === false) {
throw new Exception\RuntimeException('cannot write - connection closed?');
}
$result = $result.fgets($this->socket)."\r\n";
}
$error = ErrorHandler::stop();
if (! $result) {
throw new Exception\RuntimeException('send failed - connection closed?', 0, $error);
}
return $result;
}

/**
* read a response
*
Expand Down

0 comments on commit 379b4b3

Please sign in to comment.