WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

PHPMailer\PHPMailer

PHPMailer::sendmailSend() protected WP 1.0

Send mail using the $Sendmail program.

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

Хуков нет.

Возвращает

true/false. Null. Ничего.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->sendmailSend( $header, $body );
$header(строка) (обязательный)
The message headers
$body(строка) (обязательный)
The message body

Заметки

  • Смотрите: PHPMailer::$Sendmail

Код PHPMailer::sendmailSend() WP 5.7

<?php
protected function sendmailSend($header, $body)
{
    if ($this->Mailer === 'qmail') {
        $this->edebug('Sending with qmail');
    } else {
        $this->edebug('Sending with sendmail');
    }
    $header = static::stripTrailingWSP($header) . static::$LE . static::$LE;
    //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
    //A space after `-f` is optional, but there is a long history of its presence
    //causing problems, so we don't use one
    //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
    //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html
    //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html
    //Example problem: https://www.drupal.org/node/1057954
    //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
    if ('' === $this->Sender) {
        $this->Sender = $this->From;
    }
    if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) {
        //PHP config has a sender address we can use
        $this->Sender = ini_get('sendmail_from');
    }
    //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
    //But sendmail requires this param, so fail without it
    if (!empty($this->Sender) && static::validateAddress($this->Sender) && self::isShellSafe($this->Sender)) {
        if ($this->Mailer === 'qmail') {
            $sendmailFmt = '%s -f%s';
        } else {
            $sendmailFmt = '%s -oi -f%s -t';
        }
    } else {
        $this->edebug('Sender address unusable or missing: ' . $this->Sender);
        return false;
    }

    $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);
    $this->edebug('Sendmail path: ' . $this->Sendmail);
    $this->edebug('Sendmail command: ' . $sendmail);
    $this->edebug('Envelope sender: ' . $this->Sender);
    $this->edebug("Headers: {$header}");

    if ($this->SingleTo) {
        foreach ($this->SingleToArray as $toAddr) {
            $mail = @popen($sendmail, 'w');
            if (!$mail) {
                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
            }
            $this->edebug("To: {$toAddr}");
            fwrite($mail, 'To: ' . $toAddr . "\n");
            fwrite($mail, $header);
            fwrite($mail, $body);
            $result = pclose($mail);
            $this->doCallback(
                ($result === 0),
                [$toAddr],
                $this->cc,
                $this->bcc,
                $this->Subject,
                $body,
                $this->From,
                []
            );
            $this->edebug("Result: " . ($result === 0 ? 'true' : 'false'));
            if (0 !== $result) {
                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
            }
        }
    } else {
        $mail = @popen($sendmail, 'w');
        if (!$mail) {
            throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
        fwrite($mail, $header);
        fwrite($mail, $body);
        $result = pclose($mail);
        $this->doCallback(
            ($result === 0),
            $this->to,
            $this->cc,
            $this->bcc,
            $this->Subject,
            $body,
            $this->From,
            []
        );
        $this->edebug("Result: " . ($result === 0 ? 'true' : 'false'));
        if (0 !== $result) {
            throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
    }

    return true;
}