Forum: Ruby on Rails Errno::ECONNREFUSED (Connection refused - connect(2)): sending email in production

Posted by Kad Kerforn (kadoudal)
on 2011-12-12 15:54
(Received via mailing list)
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 =>
"myself@mydomain.com",:password =>
"xxxxxxxxxxxx",:enable_starttls_auto => false}

class MyMailer < ActionMailer::Base
def test_email
@recipients = "myself@me.com"
@from = "noreply@mydomain.com"
@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 ...
Posted by Kad Kerforn (kadoudal)
on 2011-12-12 16:25
(Received via mailing list)
[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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.