Skip to content

Commit

Permalink
Cleaner handling of last_reply, see PHPMailer#269
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Aug 25, 2014
1 parent 2b7da56 commit 16a7dbe
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions class.smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,29 +704,27 @@ protected function sendCommand($command, $commandstring, $expect)
}
$this->client_send($commandstring . self::CRLF);

$reply = $this->get_lines();
$code = substr($reply, 0, 3);
$this->last_reply = $this->get_lines();
$code = substr($this->last_reply, 0, 3);

if ($this->do_debug >= 2) {
$this->edebug('SERVER -> CLIENT: ' . $reply);
$this->edebug('SERVER -> CLIENT: ' . $this->last_reply);
}

if (!in_array($code, (array)$expect)) {
$this->last_reply = $reply;
$this->error = array(
'error' => "$command command failed",
'smtp_code' => $code,
'detail' => substr($reply, 4)
'detail' => substr($this->last_reply, 4)
);
if ($this->do_debug >= 1) {
$this->edebug(
'SMTP ERROR: ' . $this->error['error'] . ': ' . $reply
'SMTP ERROR: ' . $this->error['error'] . ': ' . $this->last_reply
);
}
return false;
}

$this->last_reply = $reply;
$this->error = array();
return true;
}
Expand Down

0 comments on commit 16a7dbe

Please sign in to comment.