The following worked for me but limited to port 25 only. 465 and 587 won't work.
Using OSTicket 1.14.1 on a Synology. PHP 7.2.24.
In the Synology, downloaded and edited the file web/osticket/upload/include/pear/Net/SMTP.php
I commented/removed out the entire section in auth() - the if ($tls && version_compare) section.
It works now. For my use, port 25 is good enough for OSTicket emails.
public function auth($uid, $pwd , $method = '', $tls = true, $authz = '')
{
/* We can only attempt a TLS connection if one has been requested,
* we're running PHP 5.1.0 or later, have access to the OpenSSL
* extension, are connected to an SMTP server which supports the
* STARTTLS extension, and aren't already connected over a secure
* (SSL) socket connection. */
/* if ($tls && version_compare(PHP_VERSION, '5.1.0', '>=')
&& extension_loaded('openssl') && isset($this->esmtp['STARTTLS'])
&& strncasecmp($this->host, 'ssl://', 6) !== 0
) {
// Start the TLS connection attempt.
if (PEAR::isError($result = $this->put('STARTTLS'))) {
return $result;
}
if (PEAR::isError($result = $this->parseResponse(220))) {
return $result;
}
if (isset($this->socket_options['ssl']['crypto_method'])) {
$crypto_method = $this->socket_options['ssl']['crypto_method'];
} else {
// STREAM_CRYPTO_METHOD_TLS_ANY_CLIENT constant does not exist
// and STREAM_CRYPTO_METHOD_SSLv23_CLIENT constant is
// inconsistent across PHP versions.
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT
| @STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT
| @STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
}
if (PEAR::isError($result = $this->socket->enableCrypto(true, $crypto_method))) {
return $result;
} elseif ($result !== true) {
return PEAR::raiseError('STARTTLS failed');
}
// Send EHLO again to recieve the AUTH string from the
* SMTP server. //
$this->negotiate();
}*/
if (empty($this->esmtp['AUTH'])) {
return PEAR::raiseError('SMTP server does not support authentication');
}