protected function PHPMailer::edebug

5.x PHPMailer.php protected PHPMailer::edebug($str)

Output debugging info via user-defined method. Only generates output if SMTP debug output is enabled (

Parameters

string $str:

See also

SMTP::$do_debug).

PHPMailer::$Debugoutput

PHPMailer::$SMTPDebug

9 calls to PHPMailer::edebug()
PHPMailer::addAnAddress in inc/PHPMailer/src/PHPMailer.php
Add an address to one of the recipient arrays or to the ReplyTo array. Addresses that have been added already return false, but do not throw exceptions.
PHPMailer::addAttachment in inc/PHPMailer/src/PHPMailer.php
Add an attachment from a path on the filesystem. Never use a user-supplied path to a file! Returns false if the file could not be found or read. Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch…
PHPMailer::addEmbeddedImage in inc/PHPMailer/src/PHPMailer.php
Add an embedded (inline) attachment from a file. This can include images, sounds, and just about any other document type. These differ from 'regular' attachments in that they are intended to be displayed inline with the message, not just…
PHPMailer::addOrEnqueueAnAddress in inc/PHPMailer/src/PHPMailer.php
Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still be modified after calling this function), addition of such…
PHPMailer::addStringAttachment in inc/PHPMailer/src/PHPMailer.php
Add a string or binary attachment (non-filesystem). This method can be used to attach ascii or binary data, such as a BLOB record from a database.

... See full list

File

inc/PHPMailer/src/PHPMailer.php, line 828

Class

PHPMailer
PHPMailer - PHP email creation and transport class.

Namespace

PHPMailer\PHPMailer

Code

protected function edebug($str) 
 {
  if ($this->SMTPDebug <= 0) {
    return;
  }
  //Is this a PSR-3 logger?
  if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) {
    $this->Debugoutput->debug($str);

    return;
  }
  //Avoid clash with built-in function names
  if (!in_array($this->Debugoutput, ['error_log', 'html', 'echo']) and is_callable($this->Debugoutput)) {
    call_user_func($this->Debugoutput, $str, $this->SMTPDebug);

    return;
  }
  switch ($this->Debugoutput) {
    case 'error_log':
      //Don't output, just log
      error_log($str);
      break;
    case 'html':
      //Cleans up output a bit for a better looking, HTML-safe output
      echo htmlentities(
      preg_replace('/[\r\n]+/', '', $str), 
      ENT_QUOTES, 
      'UTF-8'
      ), "<br>\n";
      break;
    case 'echo':
    default:
      //Normalize line breaks
      $str = preg_replace('/\r\n|\r/ms', "\n", $str);
      echo gmdate('Y-m-d H:i:s'), 
      "\t", 
      //Trim trailing space
      trim(
      //Indent for readability, except for trailing break
      str_replace(
      "\n", 
      "\n                   \t                  ", 
      trim($str)
      )
      ), 
      "\n";
  }
}