Skip to content

Commit

Permalink
Improve debug output from mail()
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Feb 19, 2021
1 parent 0f24617 commit 2a8e3a2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/PHPMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,23 +862,24 @@ private function mailPassthru($to, $subject, $body, $header, $params)
$subject = $this->encodeHeader($this->secureHeader($subject));
}
//Calling mail() with null params breaks
$this->edebug('Sending with mail()');
$this->edebug('Sendmail path: ' . ini_get('sendmail_path'));
$this->edebug("To: {$to}");
$this->edebug("Subject: {$subject}");
$this->edebug("Headers: {$header}");
if (!$this->UseSendmailOptions || null === $params) {
$this->edebug("Sending with mail()\nTo: {$to}\nSubject: {$subject}\nHeaders: {$header}");
$result = @mail($to, $subject, $body, $header);
} else {
$this->edebug(
"Sending with mail()\nTo: {$to}\nSubject: {$subject}\n" .
"Headers: {$header}\nAdditional params: {$params}"
);
$this->edebug("Additional params: {$params}");
$result = @mail($to, $subject, $body, $header, $params);
}

$this->edebug('Result: ' . ($result ? 'true' : 'false'));
return $result;
}

/**
* Output debugging info via user-defined method.
* Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).
* Output debugging info via a user-defined method.
* Only generates output if debug output is enabled.
*
* @see PHPMailer::$Debugoutput
* @see PHPMailer::$SMTPDebug
Expand Down

0 comments on commit 2a8e3a2

Please sign in to comment.