You are here

public function DrupalPHPMailer::__destruct in PHPMailer 8.3

Overrides PHPMailer::__destruct().

File

src/Plugin/Mail/DrupalPHPMailer.php, line 178

Class

DrupalPHPMailer
Implements the base PHPMailer class for the Drupal MailInterface.

Namespace

Drupal\phpmailer\Plugin\Mail

Code

public function __destruct() {

  // Disable debug output if SMTP keep-alive is enabled.
  // PHP is most likely shutting down altogether (this class is instantiated
  // as a static singleton). Since logging facilities (e.g., database
  // connection) quite potentially have been shut down already, simply turn
  // off SMTP debugging. Without this override, debug output would be printed
  // on the screen and CLI output.
  if ($this->SMTPKeepAlive && isset($this->smtp->do_debug)) {
    $this->smtp->do_debug = 0;
  }
  parent::__destruct();
}