tlsmail通过devise和action_mailer发送邮件的超时错误

时间:2014-03-14 18:27:44

标签: ruby-on-rails devise

我目前正在尝试将应用程序部署到65位centos vm,具有以下规范:

rvm 1.13.8
ruby 1.9.3p194
OpenSSL 1.0.1e-fips

我正在使用Apache,Capistrano和Phusion乘客

我的/config/environments/production.rb包含以下行

Net::SMTP.enable_tls(OpenSSL:SSL::VERIFY_NONE)
config.action_mailer.default_url_options = { :host => MY URL }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
   :enable_starttls_auto => true,
   address: "smtp.gmail.com",
   port: 587,
   domain: "gmail.com",
   authentication: "plain",
   user_name: "MyGMAILEMAIL@gmail.com",
   password: ENV["GMAIL_PASS"]

}

我的开发环境使用完全相同的设置,将更改的主机设置为我的gloabl IP。

为了更好的衡量,我的开发统计数据(32位ubuntu VM):     rvm 1.25.19     红宝石1.9.3p545     OpenSSL 1.0.0e

我的开发环境非常适合发送电子邮件,但这是我在阅读/ var / log / httpd / error_log文件时获得的内容

App 4738 stdout: Started POST "/users" for MY IP at 2014-03-14 21:11:29+0300

App 4738 stdout: Processing by Devise::RegistrationsController#create as HTML

App 4738 stdout:   Parameters: {"utf8"=>"√", "authenticity_token"=>"9CGdegNfbYkPljo1Rx/VLngfrhCLlw9IpKfPwm/uCuo=", "user"=>{"email"=>"MY EMAIL", "password"=>"[FILTERED]", "password_confirmation"=>[FILTERED]"}, "commit"=>"Signup"}

App 4676 stderr: [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

App 4676 stderr:

App 4738 stdout:   Rendered devise/mailer/confirmation_instructions.html.erb (1.1ms)

App 4738 stdout:

App 4738 stdout: Sent mail to my EMAIL (30018.6ms)

App 4738 stdout: Completed 500 Internal Server Error in 31220ms

App 4738 stdout:

App 4738 stdout: Timeout::Error (execution expired):

App 4738 stdout:   tlsmail (0.0.1) lib/net/smtp.rb:454:in `initialize'

App 4738 stdout:   tlsmail (0.0.1) lib/net/smtp.rb:454:in `open'

App 4738 stdout:   tlsmail (0.0.1) lib/net/smtp.rb:454:in `block in do_start'

App 4738 stdout:   tlsmail (0.0.1) lib/net/smtp.rb:454:in `do_start'

App 4738 stdout:   tlsmail (0.0.1) lib/net/smtp.rb:440:in `start'

App 4738 stdout:   mail (2.5.4) lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'

App 4738 stdout:   mail (2.5.4) lib/mail/message.rb:2129:in `do_delivery'

App 4738 stdout:   mail (2.5.4) lib/mail/message.rb:232:in `block in deliver'

App 4738 stdout:   actionmailer (4.0.2) lib/action_mailer/base.rb:456:in `block in deliver_mail'

我注意到的事情,当我跑步时

telnet smtp.gmail.com 587 

在我的开发虚拟机上:我得到了

trying 74.125.196.108
connected to gmail-smtp-msa.l.google.com

和我的生产VM:我得到了

trying 74.125.196.108

它挂在那里,没有确认,只是挂在那里没有任何反应。

1 个答案:

答案 0 :(得分:0)

好吧我明白了。如果有人有任何类似的问题,我会把它放在这里

运行ping smtp.gmail.com并找到IP地址

然后在您的服务器上运行csf -a {IP地址}

应该允许你的应用程序点击gmail smtp服务器