【问题标题】:Debugging an SMTP Timeout Error调试 SMTP 超时错误
【发布时间】:2011-02-20 07:04:21
【问题描述】:

我正在开发一个使用 Action Mailer 发送邮件活动的 Rails 项目。目前,我一直在使用普通的旧 GMail 帐户测试所有内容。现在离发布越来越近了,我决定将 smtp 服务器切换到我们的本地邮件服务器。

在我们尝试实际发送邮件之前,这一切都很好。使用这些新的 smtp 服务器设置,邮件程序只会超时:

MY_SMTP_SETTINGS = {
  :address => 'oz.some.server.edu',
  :port => 465,
  :user_name => MY_USERNAME,
  :authentication => :login,
  :password => MY_PASSWORD
}

这是我在尝试发送活动一段时间后收到的错误的堆栈跟踪:

    Timeout::Error: execution expired
    from /opt/local/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
    from /opt/local/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
    from /opt/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
    from /opt/local/lib/ruby/1.8/net/protocol.rb:126:in `readline'
    from /opt/local/lib/ruby/1.8/net/smtp.rb:911:in `recv_response'
    from /opt/local/lib/ruby/gems/1.8/gems/ambethia-smtp-tls-1.1.2/lib/smtp-tls.rb:19:in `do_start'
    from /opt/local/lib/ruby/1.8/net/smtp.rb:921:in `critical'
    from /opt/local/lib/ruby/gems/1.8/gems/ambethia-smtp-tls-1.1.2/lib/smtp-tls.rb:19:in `do_start'
    from /opt/local/lib/ruby/1.8/net/smtp.rb:525:in `start'
    from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:681:in `perform_delivery_smtp'
    from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `__send__'
    from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:523:in `deliver!'
    from /opt/local/lib/ruby/gems/1.8/gems/actionmailer-2.3.2/lib/action_mailer/base.rb:395:in `method_missing'
    from /Users/ryan/Development/gsoc/cohort/repo/app/models/freemailer_campaign.rb:39:in `send_campaign'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:364:in `method_missing_without_paginate'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `method_missing'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `each'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `send'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_proxy.rb:219:in `method_missing'
    from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/associations/association_collection.rb:364:in `method_missing_without_paginate'
    from /Users/ryan/Development/gsoc/cohort/repo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:167:in `method_missing'
    from /Users/ryan/Development/gsoc/cohort/repo/app/models/freemailer_campaign.rb:37:in `send_campaign'

有没有人知道我该如何查明我的问题?

【问题讨论】:

    标签: ruby-on-rails ruby email smtp


    【解决方案1】:

    问题不在于 ruby​​,而在于电子邮件服务器。确保电子邮件服务器正常工作 (testing email server through telnet console),然后重试。

    【讨论】:

      【解决方案2】:

      尝试远程登录到 SMTP 框。

      【讨论】:

        【解决方案3】:

        在您的邮件服务器上使用 telnet 的 465 端口,如果它未打开,请检查防火墙和邮件服务器配置。您也可以尝试对您的 actionmailer 设置进行此操作:

         :authentication => :plain (if so),
         :enable_starttls_auto => true
        

        【讨论】:

          【解决方案4】:

          【讨论】:

            猜你喜欢
            • 2016-05-10
            • 1970-01-01
            • 2013-12-11
            • 2015-04-14
            • 2013-08-11
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多