juli
Joined: 07 Oct 2008 Posts: 22
|
Posted: Wed Jul 01, 2009 6:12 am Post subject: OpenSSL::SSL::SSLError in Rails 2.2.2? |
|
|
Hi all,
I have a web application hosting in a shared server. my web application is developed using Rails 2.2.2 version.The problem is that "in shared server they were upgrade to rails 2.3.2 and ruby 1.8.7". I am getting following error while sending mails from my application.
OpenSSL::SSL::SSLError in WikisController#invite_users
hostname was not match with the server certificate
......
.......
please anyone help me to solve this problem.
Thanks in advance,
juli. |
|
vijay
Joined: 08 May 2008 Posts: 63
|
Posted: Wed Jul 01, 2009 6:46 am Post subject: OpenSSL::SSL::SSLError in Rails 2.2.2? |
|
|
Hi juli,
I have a solution to your problem. The problem exit with the Ruby 1.8.7 Net::SMTP. Because smtp_settings of ActionMailer in Rails 2.3.2 will enable by default one more option called :enable_starttls_auto=>true. so that you are getting OpenSSL::SSL::SSLError.
Solution: Add the follwoing patch to your web application environment.rb file and restart your rails application.
if RAILS_GEM_VERSION == '2.2.2'
module ActionMailer
class Base
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
sender = mail['return-path'] || mail.from
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
smtp_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, sender, destinations)
end
end
end
end
else
raise "you forgot to remove the ActionMailer monkey patch!"
end
I think this may help you.
regards,
vijay |
|