title: Errno::ECONNREFUSED: Connection refused - connect(2) for action mailer
body: <p>I have been working with rails since a long. Now I am facing a small issue in the ActionMailer. I want to send an email when user gets registered to confirm his registration.
  I am able to send email in the <strong>development mode</strong> but where as <strong>not</strong> in the <strong>production mode.</strong>
  <br /> the exception <strong>Errno::ECONNREFUSED: Connection refused - connect(2)</strong> is coming everytime when <strong>deliver</strong> method is called. <br />
  I have written the following code. <br />
  My SMTP config looks: <br />
        config.action_mailer.default_url_options =  { :host => "localhost:3000" }</p>
  
  <pre><code>  config.action_mailer.delivery_method = :smtp
    config.action_mailer.perform_deliveries = true
    config.action_mailer.raise_delivery_errors = true
  
    config.action_mailer.smtp_settings = {   
      :openssl_verify_mode =&gt; OpenSSL::SSL::VERIFY_NONE,      
      :ssl =&gt; true,
      :enable_starttls_auto =&gt; true,  #this is the important stuff!
      :address        =&gt; 'smtp.xxxx.xxx',
      :port           =&gt; xxx,
      :domain         =&gt; 'xxxxxx',
      :authentication =&gt; :plain,
      :user_name      =&gt; 'xxxxxxx@xxx.xxx',
      :password       =&gt; 'xxxxxxxxx'
    }
  </code></pre>
  
  <p>In the controller, I have written the following: <br /></p>
  
  <pre><code>def confirm_registration_in_c       
   @user = User.find_by_email(asdf123@gmail.com)
   if @user
        UserMailer.confirm_registration(@user).deliver            
   end
  end
  </code></pre>
  
  <p>In my user_mailer.rb : <br /></p>
  
  <pre><code>class UserMailer &lt; ActionMailer::Base
    default from: "from@example.com"
  
    def confirm_registration(user)
     @user = user
     @user_name = @user.name       
     email = @user.email 
     mail(:to =&gt; email, :subject =&gt; "Reset your password")
    end
  end
  </code></pre>
  
  <p><strong>I am able to send email in the development mode in my local host, but I am not able to send the email in the dedicated server.</strong>
  <br />
  Can anybody help me please?</p>