# Error after sending email.(conection refused- connect(2))

**URL:** <https://www.ruby-forum.com/t/error-after-sending-email-conection-refused-connect-2/135452>\
**Category:** Rails\
**Created:** [April 22, 2008, 10:49am UTC](https://www.ruby-forum.com/t/error-after-sending-email-conection-refused-connect-2/135452 "2008-04-22T10:49:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 22, 2008, 10:49am UTC](https://www.ruby-forum.com/t/error-after-sending-email-conection-refused-connect-2/135452/1 "2008-04-22T10:49:01Z")

</div>

hi all,

```
    in my application if the user forget the login details then they

```

can go to a page where they can enter their mail id and the login  
details’ll be mailed them to that mail id.after mailing them the user’ll  
be redirected to the login page.

```
       but after entering the mail id and clicking the button im

```

getting error like

Errno::ECONNREFUSED in LoginController#take\_forgotten

Connection refused - connect(2)

people knows whats the problem please help me.

---

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 22, 2008, 2:45pm UTC](https://www.ruby-forum.com/t/error-after-sending-email-conection-refused-connect-2/135452/2 "2008-04-22T14:45:06Z")

</div>

Karthikragunath B. wrote:

> hi all,
> 
> ```
> in my application if the user forget the login details then they
> 
> ```
> 
> can go to a page where they can enter their mail id and the login  
> details’ll be mailed them to that mail id.after mailing them the user’ll  
> be redirected to the login page.
> 
> ```
> but after entering the mail id and clicking the button im
> 
> ```
> 
> getting error like
> 
> Errno::ECONNREFUSED in LoginController#take\_forgotten
> 
> Connection refused - connect(2)
> 
> people knows whats the problem please help me.

Hi

I’m not sure about your specific problem but have you checked that your  
rails app is able to connect to the database/server? try this from  
script/console:

ActiveRecord::Base.connection

if that doesn’t raise any exceptions then the connection’s OK

Regards  
Saravanan

---

<div class="post-metadata">

**Author:** ![karthikragu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a88e57/32.png) [@karthikragu](https://www.ruby-forum.com/u/karthikragu)\
**Post date:** [April 22, 2008, 7:31pm UTC](https://www.ruby-forum.com/t/error-after-sending-email-conection-refused-connect-2/135452/3 "2008-04-22T19:31:46Z")

</div>

It could also be an ActionMailer error. Try Saravanan’s suggestion,  
and if you’re still getting an error, paste the whole trace. It might  
also be helpful to see your config/environment.rb contents. You could  
try setting this in the Rails::Initializer.run do |config| block:

config.action\_mailer.raise\_delivery\_errors = false

You might also need this in your environments/#{env}.rb files. Then  
again, you do want to know about delivery errors at this point, don’t  
you?

-Kyle

On Apr 22, 7:45 am, Saravanan K. \<rails-mailing-l…@andreas-
