Close #12098 : allow usage of AUTH LOGIN in smtp

Global variable MAIL_SMTP_AUTH_TYPE can be used to PLIAN to allow AUTH PLAIN authentification. Default still AUTH LOGIN.
This commit is contained in:
Denis Chenu 2019-10-18 17:35:52 +02:00
parent e8104a50ac
commit 88100a53aa

View File

@ -498,14 +498,23 @@ class SMTPs
} }
// Send Authentication to Server // Send Authentication to Server
// Check for errors along the way // Check for errors along the way
switch ($conf->global->MAIL_SMTP_AUTH_TYPE) {
case 'PLAIN':
$this->socket_send_str('AUTH PLAIN', '334');
// The error here just means the ID/password combo doesn't work.
$_retVal = $this->socket_send_str(base64_encode("\0" . $this->_smtpsID . "\0" . $this->_smtpsPW), '235');
break;
case 'LOGIN':
default:
$this->socket_send_str('AUTH LOGIN', '334'); $this->socket_send_str('AUTH LOGIN', '334');
// User name will not return any error, server will take anything we give it. // User name will not return any error, server will take anything we give it.
$this->socket_send_str(base64_encode($this->_smtpsID), '334'); $this->socket_send_str(base64_encode($this->_smtpsID), '334');
// The error here just means the ID/password combo doesn't work. // The error here just means the ID/password combo doesn't work.
// There is not a method to determine which is the problem, ID or password // There is not a method to determine which is the problem, ID or password
if ( ! $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235') ) $_retVal = $this->socket_send_str(base64_encode($this->_smtpsPW), '235');
break;
}
if(!$_retVal)
$this->_setErr(130, 'Invalid Authentication Credentials.'); $this->_setErr(130, 'Invalid Authentication Credentials.');
} }
else else