Errno::ECONNREFUSED (Connection refused - connect(2)): sending email in production

I don’t know how to get more info about this issue on my remote server
( Linux/Debian6 - Qmail)

localhost testing is fine
, so my class UserMailer < ActionMailer::Base is rendering correctly
the email ( checked in the development log)

now, testing the remote SMTP server , via the production console,
using :
ActionMailer::Base.smtp_settings = {:address =>
mail.mydomain.com”,:port => 587,:domain =>
mydomain.com”,:authentication => :login, :user_name =>
[email protected]”,:password =>
“xxxxxxxxxxxx”,:enable_starttls_auto => false}

class MyMailer < ActionMailer::Base
def test_email
@recipients = “[email protected]
@from = “[email protected]
@subject = “this is a subject”
@body = “this is the body”
end
end

MyMailer::deliver_test_email is delivering fine this test email

I used these smtp_settings, in a specific initializer file :
config/initializers/mail.rb
but then I get the Errno::ECONNREFUSED in production log, right after
the email rendering …

how can I check what’s wrong ? the production log doesn’t give me
enough info …

thanks for your feedback … I’m lost in translation …

[SOLVED] but don’t know why …
I changed :address => “mail.mydomain.com” to :address =>
“localhost” and it’s now correctly sending the email…
but why the :address => “mail.mydomain.com” was running fine in the
rails console ?? and not when the app is running ?
any clue ?

erwin