function SMTP::quit

5.x SMTP.php public SMTP::quit($close_on_error = true)

Send an SMTP QUIT command. Closes the socket if there is no error or the $close_on_error argument is true. Implements from RFC 821: QUIT <CRLF>.

Parameters

bool $close_on_error Should the connection close if an error occurs?:

Return value

bool

File

inc/PHPMailer/src/SMTP.php, line 837

Class

SMTP
PHPMailer RFC821 SMTP email transport class. Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.

Code

public function quit($close_on_error = true) {
  $noerror = $this->sendCommand('QUIT', 'QUIT', 221);
  $err = $this->error; //Save any error
  if ($noerror or $close_on_error) {
    $this->close();
    $this->error = $err; //Restore any error from the quit command
  }

  return $noerror;
}