SMTP超时错误

时间:2013-07-18 13:34:37

标签: ruby-on-rails smtp timeout

我的rails应用程序具有邮件系统,使用smtp。

我的应用程序在localhost和我办公室和家中的生产中运行完美。但是在有防火墙的公司办公室,我通过以太网连接,邮件系统失败了,出了点问题。我当时不确定错误,因为它是在生产中,我看不到错误消息。我没时间在localhost上测试。

在另一家公司大楼,使用他们的访客wifi,我试图向localhost上的用户发送邮件,我收到了超时错误,但它在生产网站上完美运行。 这是我得到的错误:

Net::OpenTimeout: execution expired
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:540:in `tcp_socket'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:550:in `block in do_start'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:549:in `do_start'
from ~/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/smtp.rb:519:in `start'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/mail-2.5.3/lib/mail/network/delivery_methods/smtp.rb:136:in `deliver!'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/mail-2.5.3/lib/mail/message.rb:2033:in `do_delivery'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/mail-2.5.3/lib/mail/message.rb:229:in `block in deliver'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:413:in `deliver_mail'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/mail-2.5.3/lib/mail/message.rb:229:in `deliver'
from (irb):6
from ~/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from ~/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in 

这是setup_mail.rb文件:

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

这是港口的问题吗?如果是这样,我应该使用哪个端口以及为什么?

如何解决此超时错误?我怎样才能绕过防火墙? 非常感谢任何帮助和建议。谢谢!

0 个答案:

没有答案