From edcb84b4ae141204ef7c8da5ea1499c423bb063f Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Wed, 15 Feb 2023 12:59:49 +0100 Subject: [PATCH] SmtpClient->Connect() use $oSettings->Ehlo --- .../v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php | 6 +++--- .../app/libraries/RainLoop/Actions/AdminDomains.php | 3 ++- .../v/0.0.0/app/libraries/RainLoop/Model/Account.php | 11 ++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php index 50c30009c..934d05534 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Smtp/SmtpClient.php @@ -72,14 +72,14 @@ class SmtpClient extends \MailSo\Net\NetClient * @throws \MailSo\Net\Exceptions\* * @throws \MailSo\Smtp\Exceptions\* */ - public function Connect(\MailSo\Net\ConnectSettings $oSettings, string $sEhloHost = '[127.0.0.1]') : void + public function Connect(\MailSo\Net\ConnectSettings $oSettings) : void { parent::Connect($oSettings); $this->validateResponse(220); - $this->ehloOrHelo($sEhloHost); - $this->sEhlo = $sEhloHost; + $this->ehloOrHelo($oSettings->Ehlo); + $this->sEhlo = $oSettings->Ehlo; if (ConnectionSecurityType::STARTTLS === $this->Settings->type || (ConnectionSecurityType::AUTO_DETECT === $this->Settings->type && $this->hasCapability('STARTTLS'))) { diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/AdminDomains.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/AdminDomains.php index 70e5b0554..461c29651 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/AdminDomains.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/AdminDomains.php @@ -132,7 +132,8 @@ trait AdminDomains $oSmtpClient->SetLogger($this->Logger()); $oSettings = $oDomain->SmtpSettings(); - $oSmtpClient->Connect($oSettings, \MailSo\Smtp\SmtpClient::EhloHelper()); + $oSettings->Ehlo = \MailSo\Smtp\SmtpClient::EhloHelper(); + $oSmtpClient->Connect($oSettings); if (!empty($aAuth['user'])) { $oSettings->Login = $aAuth['user']; diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php index 7b2268be1..126cfc90f 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Model/Account.php @@ -235,7 +235,7 @@ abstract class Account implements \JsonSerializable $oPlugins->RunHook('imap.after-connect', array($this, $oImapClient, $oSettings)); $oSettings->Password = $this->IncPassword(); - return $this->netClientLogin($oImapClient, $oPlugins, $oSettings); + return $this->netClientLogin($oImapClient, $oPlugins); } public function SmtpConnectAndLogin(\RainLoop\Plugins\Manager $oPlugins, \MailSo\Smtp\SmtpClient $oSmtpClient) : bool @@ -251,7 +251,7 @@ abstract class Account implements \JsonSerializable $oSettings->useAuth = false; return true; } - $oSmtpClient->Connect($oSettings, $oSettings->Ehlo); + $oSmtpClient->Connect($oSettings); $oPlugins->RunHook('smtp.after-connect', array($this, $oSmtpClient, $oSettings)); /* if ($this->oDomain->OutAskCredentials() && !($this->sSmtpPassword && $this->sSmtpLogin)) { @@ -259,7 +259,7 @@ abstract class Account implements \JsonSerializable } */ $oSettings->Password = $this->sSmtpPassword ?: $this->sPassword; - return $this->netClientLogin($oSmtpClient, $oPlugins, $oSettings); + return $this->netClientLogin($oSmtpClient, $oPlugins); } public function SieveConnectAndLogin(\RainLoop\Plugins\Manager $oPlugins, \MailSo\Sieve\SieveClient $oSieveClient, \RainLoop\Config\Application $oConfig) @@ -274,10 +274,10 @@ abstract class Account implements \JsonSerializable $oPlugins->RunHook('sieve.after-connect', array($this, $oSieveClient, $oSettings)); $oSettings->Password = $this->IncPassword(); - return $this->netClientLogin($oSieveClient, $oPlugins, $oSettings); + return $this->netClientLogin($oSieveClient, $oPlugins); } - private function netClientLogin(\MailSo\Net\NetClient $oClient, \RainLoop\Plugins\Manager $oPlugins, \MailSo\Net\ConnectSettings $oSettings) : bool + private function netClientLogin(\MailSo\Net\NetClient $oClient, \RainLoop\Plugins\Manager $oPlugins) : bool { /* $encrypted = !empty(\stream_get_meta_data($oClient->ConnectionResource())['crypto']); @@ -288,6 +288,7 @@ abstract class Account implements \JsonSerializable [cipher_version] => TLSv1.3 ) */ + $oSettings = $oClient->Settings; $oSettings->ProxyAuthUser = $this->sProxyAuthUser; $oSettings->ProxyAuthPassword = $this->sProxyAuthPassword;