Allow smtp response to be handled more efficiently by Socket class.

Parse test for smtp response checks more accurately at the beginning of the response.
Fixes #5062.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7461 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
TommyO 2008-08-13 16:06:23 +00:00
parent 0b5fbe04f6
commit fe62d7f70d

View file

@ -750,17 +750,9 @@ class EmailComponent extends Object{
$this->__smtpConnection->write($data . "\r\n"); $this->__smtpConnection->write($data . "\r\n");
} }
if ($checkCode !== false) { if ($checkCode !== false) {
$response = ''; $response = $this->__smtpConnection->read();
while ($str = $this->__smtpConnection->read()) { if (!preg_match('/^' . $checkCode . '/', $response)) {
$response .= $str;
if ($str[3] == ' ') {
break;
}
}
if (stristr($response, $checkCode) === false) {
$this->smtpError = $response; $this->smtpError = $response;
return false; return false;
} }