PHPMailer\PHPMailer

PHPMailer::mailPassthru()privateWP 1.0

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).

Метод класса: PHPMailer{}

Хуков нет.

Возвращает

true|false.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->mailPassthru( $to, $subject, $body, $header, $params );
$to(строка) (обязательный)
To
$subject(строка) (обязательный)
Subject
$body(строка) (обязательный)
Message Body
$header(строка) (обязательный)
Additional Header(s)
$params(строка|null) (обязательный)
Params

Код PHPMailer::mailPassthru() WP 6.4.3

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) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.mbstring_func_overloadDeprecated
        $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;
}