Artem
Artem

Reputation: 77

How to fix 'OpenSSL::SSL::SSLError' error in Ruby?

I use CloudFlare Flexible SSL certificate.

When I try send user registration confirmation, I receive 500 error. In log:

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol):

My production.rb:

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
tls: true,
    address: 'smtp.yandex.ru',
    port: 587,
    domain: 'yandex.ru',
    authentication: 'plain',
    user_name: '[email protected]',
    password: 'password',
}

How can I fix this error?

Upvotes: 1

Views: 3360

Answers (1)

Marcus Ilgner
Marcus Ilgner

Reputation: 7211

This error usually occurs if you try to establish an encrypted connection to a server that doesn't expect this. Port 587 typically requires the use of STARTTLS after first establishing an unecrypted connection. Try removing tls: true in your configuration and using enable_starttls_auto: true instead.

Upvotes: 2

Related Questions