我得到" OpenSSL :: SSL :: SSLError(主机名与服务器证书不匹配)"在rails 4生产模式下使用sendgrid
ActionMailer::Base.smtp_settings = {
:user_name => 'xxxx',
:password => 'xxxx',
:domain => 'moorem.com',
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
the following error getting
OpenSSL::SSL::SSLError (hostname does not match the server certificate):
app/controllers/pages_controller.rb:26:in `contact_create'
答案 0 :(得分:1)
证书适用于公共名称中的*.smtp.sendgrid.net
,以及主题备用名称(SAN)部分中的*.smtp.sendgrid.net
和smtp.sendgrid.net
。如果只比较它不匹配的公共名称,那么它应该与SAN相比。
所以我猜这是一个错误。我不知道你使用的是哪个ruby版本,但是在最近的版本中,主机名验证看起来也很好(对于通配符来说太过宽松)所以我建议你查看更新的ruby版本。