protected function PHPMailer::serverHostname
Search API
5.x PHPMailer.php | protected PHPMailer::serverHostname() |
Get the server hostname. Returns 'localhost.localdomain' if unknown.
Return value
string
2 calls to PHPMailer::serverHostname()
- PHPMailer::createHeader in inc/
PHPMailer/ src/ PHPMailer.php - Assemble message headers.
- PHPMailer::smtpConnect in inc/
PHPMailer/ src/ PHPMailer.php - Initiate a connection to an SMTP server. Returns false if the operation failed.
File
- inc/
PHPMailer/ src/ PHPMailer.php, line 3726
Class
- PHPMailer
- PHPMailer - PHP email creation and transport class.
Namespace
PHPMailer\PHPMailerCode
protected function serverHostname()
{
$result = '';
if (!empty($this->Hostname)) {
$result = $this->Hostname;
}
elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER)) {
$result = $_SERVER ['SERVER_NAME'];
}
elseif (function_exists('gethostname') and gethostname() !== false) {
$result = gethostname();
}
elseif (php_uname('n') !== false) {
$result = php_uname('n');
}
if (!static::isValidHost($result)) {
return 'localhost.localdomain';
}
return $result;
}