Skip to content

Commit

Permalink
SMTP::getLastReply() should be populated with last server reply, no m…
Browse files Browse the repository at this point in the history
…atter what it was

The SMTP::getLastReply() result is not populated in case of server error.
Truth be said, it should, for consistency's sake at the very least.
But real reason is that writing something like 

      if(!$inst->data($_message))
        throw new Exception('DATA command unsuccessful. Last server reply: ' . $inst->getLastReply());

is an order of magnitude cleaner, than a tantric dance with array values (you have to turn SMTP::getError() method call into variable somewhere first, too!)…

One day, someone have to turn all this into proper exceptions...
  • Loading branch information
AnrDaemon committed Aug 24, 2014
1 parent accb157 commit d45a19f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion class.smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ protected function sendCommand($command, $commandstring, $expect)
}

if (!in_array($code, (array)$expect)) {
$this->last_reply = null;
$this->last_reply = $reply;
$this->error = array(
'error' => "$command command failed",
'smtp_code' => $code,
Expand Down

0 comments on commit d45a19f

Please sign in to comment.