PHPMailer\PHPMailer

PHPMailer::serverHostname()protectedWP 1.0

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

{} It's a method of the class: PHPMailer{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->serverHostname();

Code of PHPMailer::serverHostname() WP 6.0

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;
}