Ruby on rails Rails 3 actionmail OpenSSL::SSL::SSLError
当我试图通过我的联系人表单发送电子邮件时,我收到了OpenSSL::SSL::SSLError 在我的config/application.rb中,我添加了Ruby on rails Rails 3 actionmail OpenSSL::SSL::SSLError,ruby-on-rails,ruby,ruby-on-rails-3,Ruby On Rails,Ruby,Ruby On Rails 3,当我试图通过我的联系人表单发送电子邮件时,我收到了OpenSSL::SSL::SSLError 在我的config/application.rb中,我添加了 config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "mail.vinderhim
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.vinderhimlen.dk",
:port => 587,
:user_name => "asd@vinderhimlen.dk",
:password => "x",
:authentication => :login
}
我的表格:
<%= simple_form_for [@support], :url => { :action => "create" }, :html => { :method => :post } do |f| %>
<%= f.input :sender_name, :label => 'Navn' %>
<%= f.input :email, :label => 'E-mail' %>
<%= f.input :support_type, :collection => ['Feedback', 'Idé', "Rapporter fejl", 'Business', 'Andet'], :prompt => "Valg type", :label => 'Erinde' %>
<%= f.label :Besked %>
<%= f.text_area :content, :label => 'Besked', :style => 'width:500px;', %>
<%= f.submit "submit", :value => 'Send besked' %>
<% end %>
我的配置/环境/开发:
Konkurranceportalen::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
config.perform_delivery = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
提交表单时My rails登录:
Started POST "/supports" for 127.0.0.1 at 2011-05-31 14:07:07 +0200
Processing by SupportsController#create as HTML
Parameters: {"utf8"=>"Ô£ô", "authenticity_token"=>"b4ILe7Xu4moToY8PN1X4wdyejz6
DQwnZ69FPevAWuSI=", "support"=>{"sender_name"=>"dfsdf", "email"=>"mail@freelance
rbasen.dk", "support_type"=>"Feedback", "content"=>"dsdsfsdfsdfsdfsdfsadasdasd"}
, "commit"=>"Send besked"}
←[1m←[36mSQL (0.0ms)←[0m ←[1mSELECT SUM(`tags`.`konkurrancers_count`) AS sum_
id FROM `tags`←[0m
←[1m←[35mSQL (10.0ms)←[0m describe `kategoris_konkurrancers`
←[1m←[36mKonkurrancer Load (0.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers`←[0m
←[1m←[35mCACHE (0.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurrancers`
←[1m←[36mTag Load (1.0ms)←[0m ←[1mSELECT `tags`.* FROM `tags`←[0m
Rendered notifier/support_notification.html.erb (1.0ms)
Sent mail to asd@vinderhimlen.dk (277ms)
Date: Tue, 31 May 2011 14:07:08 +0200
From: asd@freelancerbasen.dk
To: asd@vinderhimlen.dk
Message-ID: <4de4d9ecc67fdsfsdfsdf4ad@Home-Pc.mail>
Subject: New Feedback
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=EF=BB=BFhello world!
dsdsfsdfsdfsdfsdfsadasdasd=
Completed in 865ms
OpenSSL::SSL::SSLError (hostname was not match with the server certificate):
app/models/support.rb:24:in `save'
app/controllers/supports_controller.rb:9:in `create'
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_trace.erb (1.0ms)
←[1m←[35mKonkurrancer Load (1.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurr
ancers` LIMIT 15 OFFSET 0
←[1m←[36mSQL (4.0ms)←[0m ←[1mSHOW TABLES←[0m
←[1m←[35mSQL (5.0ms)←[0m SHOW TABLES
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_request_and_response.erb (252.0ms)
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/diagnostics.erb within rescues/layout (318.0ms)
你可以试试
:openssl_verify_mode => 'none'
根据配置哈希中未设置域+您应该添加:enable\u starttls\u auto=>false仍然不工作。我已经用新代码更新了。
Started POST "/supports" for 127.0.0.1 at 2011-05-31 14:07:07 +0200
Processing by SupportsController#create as HTML
Parameters: {"utf8"=>"Ô£ô", "authenticity_token"=>"b4ILe7Xu4moToY8PN1X4wdyejz6
DQwnZ69FPevAWuSI=", "support"=>{"sender_name"=>"dfsdf", "email"=>"mail@freelance
rbasen.dk", "support_type"=>"Feedback", "content"=>"dsdsfsdfsdfsdfsdfsadasdasd"}
, "commit"=>"Send besked"}
←[1m←[36mSQL (0.0ms)←[0m ←[1mSELECT SUM(`tags`.`konkurrancers_count`) AS sum_
id FROM `tags`←[0m
←[1m←[35mSQL (10.0ms)←[0m describe `kategoris_konkurrancers`
←[1m←[36mKonkurrancer Load (0.0ms)←[0m ←[1mSELECT `konkurrancers`.* FROM `kon
kurrancers`←[0m
←[1m←[35mCACHE (0.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurrancers`
←[1m←[36mTag Load (1.0ms)←[0m ←[1mSELECT `tags`.* FROM `tags`←[0m
Rendered notifier/support_notification.html.erb (1.0ms)
Sent mail to asd@vinderhimlen.dk (277ms)
Date: Tue, 31 May 2011 14:07:08 +0200
From: asd@freelancerbasen.dk
To: asd@vinderhimlen.dk
Message-ID: <4de4d9ecc67fdsfsdfsdf4ad@Home-Pc.mail>
Subject: New Feedback
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=EF=BB=BFhello world!
dsdsfsdfsdfsdfsdfsadasdasd=
Completed in 865ms
OpenSSL::SSL::SSLError (hostname was not match with the server certificate):
app/models/support.rb:24:in `save'
app/controllers/supports_controller.rb:9:in `create'
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_trace.erb (1.0ms)
←[1m←[35mKonkurrancer Load (1.0ms)←[0m SELECT `konkurrancers`.* FROM `konkurr
ancers` LIMIT 15 OFFSET 0
←[1m←[36mSQL (4.0ms)←[0m ←[1mSHOW TABLES←[0m
←[1m←[35mSQL (5.0ms)←[0m SHOW TABLES
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/_request_and_response.erb (252.0ms)
Rendered C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.3/lib/action_dispatc
h/middleware/templates/rescues/diagnostics.erb within rescues/layout (318.0ms)
config.action_mailer.smtp_settings = {:enable_starttls_auto => false }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "mail.vinderhimlen.dk",
:port => 587,
:user_name => "asd@vinderhimlen.dk",
:password => "x",
:authentication => :login,
:domain => "vinderhimlen.dk",
:enable_starttls_auto => false
}
:openssl_verify_mode => 'none'