Rails 3.2.13 / Mail 2.5.3 OpenSSL error

by Steve Hoeksema, posted 19 Mar 2013.

If you get an error like this:

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

It might be because you are sending emails on localhost and don’t have SSL set up on your mail server.

The behaviour between Mail 2.4.4 (Rails 3.2.12) and Mail 2.5.3 (Rails 3.2.13) changed, and I needed to explicitly disable enable_starttls_auto:

config.action_mailer.smtp_settings = {
  :enable_starttls_auto => false
}
Also available as an Atom feed.
This post licensed as CC BY-NC-SA.