mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
More correct function smtp ehlo definitions.
This commit is contained in:
parent
e673405dbe
commit
0f7ebc084a
2 changed files with 27 additions and 1 deletions
|
|
@ -111,6 +111,32 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
return $this->IsAuthSupported('PLAIN') || $this->IsAuthSupported('LOGIN');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function EhloHelper()
|
||||
{
|
||||
$sEhloHost = empty($_SERVER['SERVER_NAME']) ? '' : \trim($_SERVER['SERVER_NAME']);
|
||||
if (empty($sEhloHost))
|
||||
{
|
||||
$sEhloHost = empty($_SERVER['HTTP_HOST']) ? '' : \trim($_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
if (empty($sEhloHost))
|
||||
{
|
||||
$sEhloHost = \function_exists('gethostname') ? \gethostname() : 'localhost';
|
||||
}
|
||||
|
||||
$sEhloHost = \trim(\preg_replace('/:\d+$/', '', \trim($sEhloHost)));
|
||||
|
||||
if (\preg_match('/^\d+\.\d+\.\d+\.\d+$/', $sEhloHost))
|
||||
{
|
||||
$sEhloHost = '['.$sEhloHost.']';
|
||||
}
|
||||
|
||||
return empty($sEhloHost) ? 'localhost' : $sEhloHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sServerName
|
||||
* @param int $iPort = 25
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue