diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php index 494c663db..89f086969 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php @@ -131,6 +131,9 @@ class ImapClient extends \MailSo\Net\NetClient } $type = ''; + if ($this->Encrypted()) { + \array_unshift($oSettings->SASLMechanisms, 'PLAIN', 'LOGIN'); + } foreach ($oSettings->SASLMechanisms as $sasl_type) { if ($this->hasCapability("AUTH={$sasl_type}") && \SnappyMail\SASL::isSupported($sasl_type)) { $type = $sasl_type; @@ -159,8 +162,7 @@ class ImapClient extends \MailSo\Net\NetClient { if (\str_starts_with($type, 'SCRAM-')) { - $sAuthzid = $this->getResponseValue($this->SendRequestGetResponse('AUTHENTICATE', array($type)), Enumerations\ResponseType::CONTINUATION); - $this->sendRaw($SASL->authenticate($sLogin, $sPassword/*, $sAuthzid*/), true); + $this->sendRaw($this->SendRequestGetResponse('AUTHENTICATE', array($type, $SASL->authenticate($sLogin, $sPassword)))); $sChallenge = $SASL->challenge($this->getResponseValue($this->getResponse(), Enumerations\ResponseType::CONTINUATION)); $this->logMask($sChallenge); $this->sendRaw($sChallenge); diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Net/ConnectSettings.php b/snappymail/v/0.0.0/app/libraries/MailSo/Net/ConnectSettings.php index 624e028c2..f37c3cca3 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Net/ConnectSettings.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Net/ConnectSettings.php @@ -72,7 +72,7 @@ class ConnectSettings implements \JsonSerializable } $object->shortLogin = !empty($aSettings['shortLogin']); $object->ssl = SSLContext::fromArray($aSettings['ssl'] ?? []); - if (isset($aSettings['sasl'])) { + if (!empty($aSettings['sasl']) && \is_array($aSettings['sasl'])) { $object->SASLMechanisms = $aSettings['sasl']; } // $object->tls_weak = !empty($aSettings['tls_weak']);