简体   繁体   English

连接被拒绝-“ localhost”端口25 Chef devops的connect(2)

[英]Connection refused - connect(2) for “localhost” port 25 chef devops

I am working on chef(devops) where I have a helper library with the following code in it 我正在chef(devops)上工作,在其中有一个包含以下代码的帮助程序库

require 'net/smtp'

module HandlerSendEmail
class Helper

def send_email_on_run_failure(node_name)

  message = "From: Chef <chef@chef.io>\n"
  message << "To: Grant <xyz@test.com>\n"
  message << "Subject: Chef run failed\n"
  message << "Date: #{Time.now.rfc2822}\n\n"
  message << "Chef run failed on #{node_name}\n"
  Net::SMTP.start('localhost', 25) do |smtp|
    smtp.send_message message, 'chef@chef.io', 'xyz@test.com'
  end
end

end end 结束

But whhen I run the recipe I get 但是当我运行食谱时,我得到了

Chef Client failed. 0 resources updated in 02 seconds
[2017-10-30T05:19:38+00:00] ERROR: Connection refused - connect(2) for "localhost" port 25
[2017-10-30T05:19:38+00:00] ERROR: Connection refused - connect(2) for "localhost" port 25

I tried changing port to 90 and some other options I keep getting same error.There are some solution available on few posts on stackoverflow already but all of them are talking about some other .rb files which is not present on my dev environment. 我尝试将端口更改为90,并且其他一些选项仍然遇到相同的错误.stackoverflow上的一些帖子已经提供了一些解决方案,但所有这些都在谈论我的开发环境中不存在的其他.rb文件。

Connection refused - connect(2) Ruby on Rails Mail Setup Errno::ECONNREFUSED: Connection refused - connect(2) for action mailer 连接被拒绝 -connect (2)Ruby on Rails邮件设置 Errno :: ECONNREFUSED:连接被拒绝-动作邮件程序的connect(2)

You would need to have an actual SMTP server listening on localhost and I'm guessing you don't have one. 您可能需要在本地主机上侦听一个实际的SMTP服务器,而我猜您还没有一个。 Without more information it's hard to say though. 没有更多的信息,虽然很难说。 If you don't want run your own relay server, you can find instructions all over the internet for setting up outbound SMTP via GMail, Amazon SES, Sparkpost, Sendgrid, and may more. 如果您不想运行自己的中继服务器,则可以在Internet上找到有关通过GMail,Amazon SES,Sparkpost,Sendgrid等进行设置出站SMTP的说明。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:连接被拒绝-“ localhost”端口25的connect(2) - Error: Connection refused - connect(2) for “localhost” port 25 连接被拒绝 - “localhost”端口 25 rails 的 connect(2) - Connection refused - connect(2) for "localhost" port 25 rails SendGrid + Ruby on Rails 6 on DigitalOcean Apps + Errno::ECONNREFUSED(连接被拒绝 - “localhost”端口 25 的连接(2)): - SendGrid + Ruby on Rails 6 on DigitalOcean Apps + Errno::ECONNREFUSED (Connection refused - connect(2) for “localhost” port 25): 连接被拒绝-“ localhost”端口587的connect(2) - Connection refused - connect(2) for “localhost” port 587 连接被拒绝 - 使用DigitalOcean连接(2)“localhost”端口9200 - Connection refused - connect(2) for “localhost” port 9200 with DigitalOcean Errno :: ECONNREFUSED(连接被拒绝-“ localhost”端口587的connect(2))操作邮件 - Errno::ECONNREFUSED (Connection refused - connect(2) for “localhost” port 587) action mailer curl: (7) 无法连接到本地主机端口 3000:连接被拒绝 - curl: (7) Failed to connect to localhost port 3000: Connection refused 连接被拒绝 - “本地主机”端口 1025 的连接(2) - 设计邮件程序 - Connection refused - connect(2) for "localhost" port 1025 - Devise Mailer 法拉第:: ConnectionFailed,连接被拒绝 - 连接(2)为“localhost”端口9200 - Faraday::ConnectionFailed, Connection refused - connect(2) for “localhost” port 9200 Seahorse :: Client :: NetworkingError:连接被拒绝-“ localhost”端口8000的connect(2) - Seahorse::Client::NetworkingError: Connection refused - connect(2) for “localhost” port 8000
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM