简体   繁体   English

Rails 3 ActionMailer错误 - 主机名与服务器证书不匹配

[英]Rails 3 ActionMailer error - hostname was not match with the server certificate

I am setting up SMTP for my Rails 3 App. 我正在为我的Rails 3应用程序设置SMTP。

This configuration works. 这种配置有效。

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {  
  :address              => "smtp.gmail.com",  
  :port                 => 587,  
  :domain               => "mydomain.com",  
  :user_name            => "<username>",  
  :password             => "<password>",  
  :authentication       => "plain",  
  :enable_starttls_auto => true  
}

But this configuration doesn't. 但是这种配置没有。 It gives "hostname was not match with the server certificate" 它给出“主机名与服务器证书不匹配”

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {  
  :address              => "some_other_server.com",  
  :port                 => 587,  
  :domain               => "mydomain.com",  
  :user_name            => "<username>",  
  :password             => "<password>",  
  :authentication       => "plain",  
  :enable_starttls_auto => true  
}

Strangely, the same configuration works in Rails 2.3.8. 奇怪的是,相同的配置在Rails 2.3.8中有效。 (:tls => true) (:tls => true)

What's wrong? 怎么了?

Try this in your ActionMailer smtp settings: 在ActionMailer smtp设置中尝试此操作:

:openssl_verify_mode => 'none'

It gives you a secure connection, but doesn't verify things. 它为您提供安全连接,但不验证任何事情。 Might not be the best idea for a production app, but it works for me. 可能不是生产应用程序的最佳主意,但它适用于我。

I had the exact same problem. 我有同样的问题。 Solved it by changing ActionMailer::Base.smtp_settings: 通过更改ActionMailer :: Base.smtp_settings解决了这个问题:

:enable_starttls_auto => true  

to

:enable_starttls_auto => false

and had to make sure :user_name value included the @domain.com 并且必须确保:user_name值包含@ domain.com

Are you supplying a default address in your mailer (located in app/mailers)? 您是否在邮件中提供了默认地址(位于app / mailers中)? The last time I recall having this problem, the hostname in my mailer didn't match the hostname in my smtp settings. 我最后一次回忆起这个问题,我的邮件程序中的主机名与我的smtp设置中的主机名不匹配。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Rails3 中的 ActionMailer 问题。 (ssl 主机名与服务器证书不匹配) - Problem with ActionMailer in Rails3. (ssl hostname was not match with the server certificate) 将文件上传到带有载波错误主机名的亚马逊aws3导轨与服务器证书不匹配 - Upload files to amazon aws3 rails with carrierwave error hostname does not match the server certificate Rails 3:OpenSSL :: SSL :: SSLError:hostname与服务器证书不匹配 - Rails 3: OpenSSL::SSL::SSLError: hostname was not match with the server certificate 安装Gem的Rails - 主机名与服务器证书不匹配 - Rails installing a Gem - hostname does not match the server certificate Mechanize和HTTParty中的“主机名与服务器证书不匹配”错误 - “Hostname does not match the server certificate” error in Mechanize and HTTParty 使用Devise + Omniauth进行FB Connect获取错误:主机名与服务器证书不匹配 - FB Connect with Devise + Omniauth get error: hostname was not match with the server certificate 使用sendgrid在rails 4中获取“OpenSSL :: SSL :: SSLError(主机名与服务器证书不匹配)” - getting “OpenSSL::SSL::SSLError (hostname does not match the server certificate)” in rails 4 using sendgrid Amazon S3 - 主机名与服务器证书不匹配 (OpenSSL::SSL::SSLError) + rails - Amazon S3 - hostname does not match the server certificate (OpenSSL::SSL::SSLError) + rails Rails 3动作邮件程序生成OpenSSL :: SSL :: SSLError:主机名与服务器证书不匹配 - Rails 3 action mailer production OpenSSL::SSL::SSLError: hostname does not match the server certificate 如何为Rails ActionMailer配置主机名? - How do I configure the hostname for Rails ActionMailer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM