[英]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.