Better fix for #780

This commit is contained in:
the-djmaze 2022-12-16 11:45:24 +01:00
parent edd083801f
commit 3fdb2e7698

View file

@ -119,7 +119,7 @@ class ImapClient extends \MailSo\Net\NetClient
$this->sLogginedUser = $sLogin;
$type = 'LOGIN';
$type = '';
foreach ($oSettings->SASLMechanisms as $sasl_type) {
if ($this->IsSupported("AUTH={$sasl_type}") && \SnappyMail\SASL::isSupported($sasl_type)) {
$type = $sasl_type;
@ -127,8 +127,8 @@ class ImapClient extends \MailSo\Net\NetClient
}
}
// RFC3501 6.2.3
if ('LOGIN' === $type && $this->IsSupported('LOGINDISABLED')) {
$type = '';
if (!$type && \in_array('LOGIN', $oSettings->SASLMechanisms) && !$this->IsSupported('LOGINDISABLED')) {
$type = 'LOGIN';
}
if (!$type) {
if (!$this->Encrypted() && $this->IsSupported('STARTTLS')) {