You are here

public function DrupalPHPMailer::__destruct in PHPMailer 6.3

Same name and namespace in other branches
  1. 5.2 includes/phpmailer.class.inc \DrupalPHPMailer::__destruct()
  2. 6.2 includes/phpmailer.class.inc \DrupalPHPMailer::__destruct()
  3. 7.4 includes/phpmailer.class.inc \DrupalPHPMailer::__destruct()
  4. 7.3 includes/phpmailer.class.inc \DrupalPHPMailer::__destruct()

Overrides PHPMailer::__destruct().

File

includes/phpmailer.class.inc, line 152
Implements the base PHPMailer for Drupal class.

Class

DrupalPHPMailer
Base PHPMailer for Drupal implementation with support for SMTP keep-alive and setting a custom Return-Path.

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();
}