PHPMailer\PHPMailer
PHPMailer::mailPassthru
Call mail() in a safe_mode-aware fashion. Also, unless sendmail_path points to sendmail (or something that claims to be sendmail), don't pass params (not a perfect fix, but it will do).
Method of the class: PHPMailer{}
No Hooks.
Returns
true|false.
Usage
// private - for code of main (parent) class only $result = $this->mailPassthru( $to, $subject, $body, $header, $params );
- $to(string) (required)
- To.
- $subject(string) (required)
- Subject.
- $body(string) (required)
- Message Body.
- $header(string) (required)
- Additional Header(s).
- $params(string|null) (required)
- Params.
PHPMailer::mailPassthru() PHPMailer::mailPassthru code WP 6.9.1
private function mailPassthru($to, $subject, $body, $header, $params)
{
//Check overloading of mail function to avoid double-encoding
if ((int)ini_get('mbstring.func_overload') & 1) {
$subject = $this->secureHeader($subject);
} else {
$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("Envelope sender: {$this->Sender}");
$this->edebug("To: {$to}");
$this->edebug("Subject: {$subject}");
$this->edebug("Headers: {$header}");
if (!$this->UseSendmailOptions || null === $params) {
$result = @mail($to, $subject, $body, $header);
} else {
$this->edebug("Additional params: {$params}");
$result = @mail($to, $subject, $body, $header, $params);
}
$this->edebug('Result: ' . ($result ? 'true' : 'false'));
return $result;
}