PHPMailer\PHPMailer

PHPMailer::clearCustomHeader()publicWP 1.0

Clear a specific custom header by name or name and value. $name value can be overloaded to contain both header name and value (name:value).

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

Хуков нет.

Возвращает

true|false. True if a header was replaced successfully

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

$PHPMailer = new PHPMailer();
$PHPMailer->clearCustomHeader( $name, $value );
$name(строка) (обязательный)
Custom header name
$value(строка|null)
Header value
По умолчанию: null

Код PHPMailer::clearCustomHeader() WP 6.7.1

public function clearCustomHeader($name, $value = null)
{
    if (null === $value && strpos($name, ':') !== false) {
        //Value passed in as name:value
        list($name, $value) = explode(':', $name, 2);
    }
    $name = trim($name);
    $value = (null === $value) ? null : trim($value);

    foreach ($this->CustomHeader as $k => $pair) {
        if ($pair[0] == $name) {
            // We remove the header if the value is not provided or it matches.
            if (null === $value ||  $pair[1] == $value) {
                unset($this->CustomHeader[$k]);
            }
        }
    }

    return true;
}