OpenSSL connection Error called stream_socket_enable_crypto()

I had the same error.

stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

It was caused by incorrect SMTP settings. I had:

$transport = Swift_SmtpTransport::newInstance('mail.myserver.com', 465, 'tls');

and as soon as I corrected it to

$transport = Swift_SmtpTransport::newInstance('mail.myserver.com', 465, 'ssl');

it worked normally. Quite a non-intuitive error message but I got there in the end.