mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-19 07:59:54 +00:00
Reading a smtp response until EOL. Fixes #378
This commit is contained in:
parent
8b6c974cd0
commit
e02cb81a67
1 changed files with 9 additions and 1 deletions
|
@ -880,7 +880,15 @@ class EmailComponent extends Object{
|
||||||
$this->__smtpConnection->write($data . "\r\n");
|
$this->__smtpConnection->write($data . "\r\n");
|
||||||
}
|
}
|
||||||
while ($checkCode !== false) {
|
while ($checkCode !== false) {
|
||||||
$response = $this->__smtpConnection->read();
|
$response = '';
|
||||||
|
$startTime = time();
|
||||||
|
while (substr($response, -2) !== "\r\n" && ((time() - $startTime) < $this->smtpOptions['timeout'])) {
|
||||||
|
$response .= $this->__smtpConnection->read();
|
||||||
|
}
|
||||||
|
if (substr($response, -2) === "\r\n") {
|
||||||
|
$this->smtpError = 'timeout';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$response = end(explode("\r\n", rtrim($response, "\r\n")));
|
$response = end(explode("\r\n", rtrim($response, "\r\n")));
|
||||||
|
|
||||||
if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
|
if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue