PHPMailer\PHPMailer

PHPMailer::serverHostname()protectedWP 1.0

Get the server hostname. Returns 'localhost.localdomain' if unknown.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->serverHostname();

Код PHPMailer::serverHostname() WP 6.4.3

protected function serverHostname()
{
    $result = '';
    if (!empty($this->Hostname)) {
        $result = $this->Hostname;
    } elseif (isset($_SERVER) && array_key_exists('SERVER_NAME', $_SERVER)) {
        $result = $_SERVER['SERVER_NAME'];
    } elseif (function_exists('gethostname') && gethostname() !== false) {
        $result = gethostname();
    } elseif (php_uname('n') !== false) {
        $result = php_uname('n');
    }
    if (!static::isValidHost($result)) {
        return 'localhost.localdomain';
    }

    return $result;
}