【问题标题】:Rails mailer not working Net::OpenTimeoutRails 邮件程序不工作 Net::OpenTimeout
【发布时间】:2020-05-14 16:33:40
【问题描述】:

Rails Server 正在本地 Mac 中运行。 Mailer 在我的办公室网络中工作和发送邮件,但在我的家庭(宽带)网络中不起作用。网络问题?

这里是错误:

Net::OpenTimeout

这是我在 development.rb 中的设置:

config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    address: 'smtp.gmail.com',
    port: 587,
    domain: 'gmail',
    authentication: 'plain',
    user_name:  '***@gmail.com',
    password: '******',
    enable_starttls_auto: true
  }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  #config.action_mailer.delivery_method = :test
  host = 'localhost:3000'
  config.action_mailer.default_url_options = { host: host, protocol: 'https' }

我尝试过使用不同的端口,但没有帮助。可能是什么问题,或者我该如何调试?

【问题讨论】:

    标签: ruby-on-rails smtp mailer


    【解决方案1】:

    是的,肯定是网络问题。
    由于 MacOS 摆脱了telnet,你可以使用netcat

    $ nc -vz smtp.gmail.com 587
    Connection to smtp.gmail.com port 587 [tcp/submission] succeeded!
    

    如果没有“成功”,请询问您的互联网提供商支持。
    错误端口超时示例:

    nc -vz smtp.gmail.com 1187
    nc: connectx to smtp.gmail.com port 1187 (tcp) failed: Operation timed out
    

    【讨论】:

      猜你喜欢
      • 2014-12-10
      • 2019-09-01
      • 2014-05-19
      • 1970-01-01
      • 2014-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多