santosh
santosh

Reputation: 1611

OpenSSL::SSL::SSLError in UsersController#create (SSL_connect returned=1 errno=0 state=unknown state: unknown protocol)

I have seen a lot of StackOverFlow answer and posting this question again. Raising problem while sending mail sometime it is working fine if i restart the server i am facing the problem again.

SMTP Settings:

config.action_mailer.smtp_settings = {
 address:              'smtp.1and1.com',
 port:                 25,
 domain:               'leotechnosoft.net',
 user_name:            '[email protected]',
 password:             'password',
 openssl_verify_mode:  'none',
 authentication:       'plain',
 enable_starttls_auto: true  }

Error

OpenSSL::SSL::SSLError in UsersController#create

SSL_connect returned=1 errno=0 state=unknown state: unknown protocol

I tired with changing the settings ssl true/false, tls true/false, open_ssl_verify_mode:none enable_starttls_auto: true.

Please Explain me what is root cause for this problem and how can i resolve.

Ruby 1.9.3 (Actually the problem has raised after upgrading to ruby 2.1.2 and then its not working in 1.9.3 also)

Ubuntu 12.04

Thanks

Upvotes: 0

Views: 4557

Answers (2)

I was getting the same message using gmail smtp, but when i changed from "plain" to "login", the problem was solved.

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.smtp_settings = {
      enable_starttls_auto: true,
      address:              'smtp.gmail.com',
      port:                 587,
      domain:               'gmail.com',
      user_name:            '[email protected]',
      password:             'yourpassword',
      authentication:       :login
    }

Upvotes: 1

Marc Lainez
Marc Lainez

Reputation: 3080

It appears to be related to a known bug in ubuntu 12.04 when using openssl 1.0.1 as described in the last answer here:

OpenSSL::SSL::SSLError Ubuntu 12.04 only

You can find more information about the bug on Ubuntu's bug tracker https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371

Apparently, if you force the use of SSLv3, the error should disappear.

Ruby SSL error - sslv3 alert unexpected message

You might also want to check out if leotechnosoft.net is blocking port 25 when using SSL as some hosting providers sometimes block port 25 by default. When you're using SSL try with port 465 instead.

Upvotes: 0

Related Questions