A user is receiving the error below when sending updates/replies on tickets. Moreover, the replies are not being sent via email.
stream_socket_enable_crypto(): SSL: Success (./__swift/thirdparty/SwiftMailer/classes/SwiftMailer/Transport/StreamBuffer.php:94)
This error suggests that a connection cannot be established with the SMTP server due to a problem with the TLS protocol used which results in the email delivery failing.
The TLS protocol used for the connection is generally handled internally by PHP and should default to the highest version supported by both endpoints. Nevertheless, if one encounters this problem with their environment, it would be necessary to manually specify the TLS version that Kayako should use as part of the code.
As usual, before making any changes it is recommended to make a backup of the file before changing its code.
The file to modify is located in the following path in your Kayako installation folder: __swift/thirdparty/SwiftMailer/classes/SwiftMailer/Transport/StreamBuffer.php. As stated in the error message, the line to modify is 94, and one would need to replace STREAM_CRYPTO_METHOD_TLS_CLIENT for the version required by the SMTP server such as STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT (TLS 1.2).
In case one doesn't know the specific TLS version to use, one can add multiple protocols separated by pipes. For instance, the line of code below would allow TLS versions 1.0, 1.1, and 1.2 which work for most setups.
return stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
Once the code has been updated and the connection is working, the ticket updates should be sent emails without any issues.