【问题标题】:SendGrid + Ruby on Rails 6 on DigitalOcean Apps + Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25):DigitalOcean Apps 上的 SendGrid + Ruby on Rails 6 + Errno::ECONNREFUSED(连接被拒绝 - “localhost”端口 25 的连接(2)):
【发布时间】:2021-06-14 00:29:51
【问题描述】:

我认为此错误与 ENV API 密钥有关。这在我的本地主机上运行良好,但在服务器上运行良好。

我将我的 API 密钥添加到 组件/环境变量:

还有我的 development.rb 文件。如下:

  config.action_mailer.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    :address        => "smtp.sendgrid.net",
    :port           => "587",
    :authentication => :plain,
    :user_name      => 'apikey',
    :password       => ENV['SENDGRID_API_KEY']
  }

我仍然收到如下错误

Errno::ECONNREFUSED(连接被拒绝 - “localhost”端口 25 的连接(2)):

【问题讨论】:

    标签: ruby-on-rails environment-variables digital-ocean sendgrid econnrefused


    【解决方案1】:

    啊!在这上面浪费了 2 天。我所要做的就是将 Actionmailer 设置添加到

    production.rb

    我之前只在 development.rb 文件中有过。呵呵!!

    【讨论】:

      猜你喜欢
      • 2016-07-16
      • 1970-01-01
      • 2013-08-15
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      • 2015-09-09
      • 2016-03-24
      • 2018-04-11
      相关资源
      最近更新 更多