0

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:            'santoshk@leotechnosoft.net',
 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

santosh
  • 1,611
  • 1
  • 13
  • 21

2 Answers2

1

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:            'youremail@gmail.com',
      password:             'yourpassword',
      authentication:       :login
    }
0

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.

Community
  • 1
  • 1
Marc Lainez
  • 3,070
  • 11
  • 16
  • This is unfortunate that using SSLv3 is the fix, as it is no longer to be trusted because of the POODLE vulnerability. – Tim Holt Nov 13 '14 at 18:47
  • You're right... The vulnerability was found after my original post. I'll try to submit an updated answer as soon as I can get my head around it. – Marc Lainez Nov 13 '14 at 19:09