OK - I'm in way over my head here. I'm using:
- ruby-1.9.3-p0
- rails-3.1.3
- mail-2.3.0
- devise-1.5.3
Trying to turn on Devise's :confirmable
option and start up smtp services in my app. As soon as I add /config/initializers/setup_mail.rb
, add Devise's necessary columns in my DB, and the :confirmable
attribute to my User
model, I get a segmentation fault. It occurs right after a user signs up. Devise
is trying to send out the confirmation email, causing the ruby smtp library to crash with the following:
... lib/ruby/1.9.1/net/smtp.rb:583: [BUG] Segmentation fault
The last entry in log/development.log
:
Rendered devise/mailer/confirmation_instructions.html.erb (1.2ms)
My /config/initializers/setup_mail.rb
file:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "mydomain.com",
:user_name => "support@mydomain.com",
:password => "???????",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = "localhost:3000"
My config/environments/development.rb
file has the following:
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Here is the germane code from ruby/1.9.1/net/smtp.rb (line 583 is near the middle):
def ssl_socket(socket, context)
OpenSSL::SSL::SSLSocket.new socket, context
end
def tlsconnect(s)
verified = false
s = ssl_socket(s, @ssl_context)
logging "TLS connection started"
s.sync_close = true
s.connect # THIS IS LINE 583
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
verified = true
s
ensure
s.close unless verified
end
It looks like the segmentation fault occurs when smtp is trying to connect via a SSL socket connection ( s.connect
). In setup_mail.rb
I've tried setting :enable_starttls_auto
to both true
and false
. I don't get the segmentation fault when it is set to false
but no email goes out, so that is useless.
I'm easily able to connect to gmail's smtp service by running this command from my Mac:
$ telnet smtp.gmail.com 587
Not sure where to go from here - any suggestions?