In my situation, I encountered similar problems when I was trying to making through a sending-email Rails app tutorial, the Heroku logs kept telling my that
......
Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25):
......
After I compared my code with author’s code, I got to find out that I had not setup my ActionMailer configurations in the config/environments/production.rb file.
Then I came to realized that I just had my config/environments/development.rb configured for sending-email, but I had not done it for my config/environments/production.rb.
So you may check it when your app’s behavior difers between development and production.