Fixed problem where already-authorized user was failing.

Added return of respond code found on success, allowing for more fine-grained post-query activity.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7714 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
TommyO 2008-10-08 17:53:48 +00:00
parent 5c962accc1
commit d5dbb7ba32

View file

@ -689,15 +689,17 @@ class EmailComponent extends Object{
} }
if (isset($this->smtpOptions['username']) && isset($this->smtpOptions['password'])) { if (isset($this->smtpOptions['username']) && isset($this->smtpOptions['password'])) {
if (!$this->__smtpSend('AUTH LOGIN', '334')) { $authRequired = $this->__smtpSend('AUTH LOGIN', '334|503');
return false; if ($authRequired == '334') {
}
if (!$this->__smtpSend(base64_encode($this->smtpOptions['username']), '334')) { if (!$this->__smtpSend(base64_encode($this->smtpOptions['username']), '334')) {
return false; return false;
} }
if (!$this->__smtpSend(base64_encode($this->smtpOptions['password']), '235')) { if (!$this->__smtpSend(base64_encode($this->smtpOptions['password']), '235')) {
return false; return false;
} }
} elseif ($authRequired != '503') {
return false;
}
} }
if (!$this->__smtpSend('MAIL FROM: ' . $this->__formatAddress($this->from, true))) { if (!$this->__smtpSend('MAIL FROM: ' . $this->__formatAddress($this->from, true))) {
@ -748,11 +750,12 @@ class EmailComponent extends Object{
if ($checkCode !== false) { if ($checkCode !== false) {
$response = $this->__smtpConnection->read(); $response = $this->__smtpConnection->read();
if (!preg_match('/^' . $checkCode . '/', $response)) { if (preg_match('/^(' . $checkCode . ')/', $response, $code)) {
return $code[0];
}
$this->smtpError = $response; $this->smtpError = $response;
return false; return false;
} }
}
return true; return true;
} }
/** /**