Errno :: ECONNREFUSED(Connection refused - 连接(2)无端口587):对于Heroku上的Rails [英] Errno::ECONNREFUSED (Connection refused - connect(2) for nil port 587): for Rails on Heroku
问题描述
我怀疑我在这里失去了一些基本的东西,但一直在与这个摔跤没有运气。
Rails 4.2.5
Ruby 2.2.3p173
使用Amazon SES,电子邮件可以在 localhost
上正常发送(我遵循 this stellar指南),但不适用于Heroku生产环境。我在帖子标题中收到错误:
$ b
Errno :: ECONNREFUSED(Connection refused - connect(2)for nil port 587 )
我怀疑问题的核心是那里的 nil
,但我一直无法弄清楚它来自哪里。没有其他人似乎有这个问题,甚至调试级日志不给我任何更多的工作。
我读过几十个帖子,如此。但我的配置尽可能匹配所有规格。
任何帮助/建议都将非常感谢。
<
development.rb
#设计
配置。 action_mailer.default_url_options = {host:'localhost',port:3000}
#配置邮件程序
config.action_mailer.delivery_method =:smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default:charset => utf-8
config.action_mailer.smtp_settings = {
:address => ENV ['SES_ADDRESS'],
:port => 587,
:enable_starttls_auto => true,
:user_name => ENV ['SES_ACCESS_KEY_ID'],
:password => ENV ['SES_SECRET'],
:authentication => :login
}
production.rb $ c $
#设计
config.action_mailer.default_url_options = {:host => 'myappname.herokuapp.com'}
#配置邮件程序
config.action_mailer.delivery_method =:smtp
config.action_mailer.perform_deliveries = true
config.action_mailer。 raise_delivery_errors = true
config.action_mailer.default:charset => utf-8
config.action_mailer.smtp_settings = {
:address => ENV ['SES_ADDRESS'],
:port => 587,
:enable_starttls_auto => true,
:user_name => ENV ['SES_ACCESS_KEY_ID'],
:password => ENV ['SES_SECRET'],
:authentication => :login
}
,确保您的SES端点处于生产模式,并且您应该很好。
I suspect I'm missing something basic here, but been wrestling with this one for a while with no luck.
Rails 4.2.5
Ruby 2.2.3p173
Emails are sending fine on localhost
using Amazon SES (I followed this stellar guide) but not on a Heroku production environment. I'm receiving the error in the title of the post:
Errno::ECONNREFUSED (Connection refused - connect(2) for nil port 587)
I suspect the core of the problem is the nil
in there, but I haven't been able to figure out where it's coming from. No one else seems to have that problem and even debug level logs don't give me anything more to work with.
I've read dozens of posts like this. But my configurations match all spec as far as I can tell.
Any help/recommendations would be much appreciated.
development.rb
# Devise
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Configure mailer
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => ENV['SES_ADDRESS'],
:port => 587,
:enable_starttls_auto => true,
:user_name => ENV['SES_ACCESS_KEY_ID'],
:password => ENV['SES_SECRET'],
:authentication => :login
}
production.rb
# Devise
config.action_mailer.default_url_options = { :host => 'myappname.herokuapp.com'}
# Configure mailer
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => ENV['SES_ADDRESS'],
:port => 587,
:enable_starttls_auto => true,
:user_name => ENV['SES_ACCESS_KEY_ID'],
:password => ENV['SES_SECRET'],
:authentication => :login
}
Set your environment variables, make sure your SES endpoint is in production mode and you should be good.
这篇关于Errno :: ECONNREFUSED(Connection refused - 连接(2)无端口587):对于Heroku上的Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!