title: ActionMailer not sending mail in Rails 3.1.1
body: <p>I'm getting error in ActionMailer when my worker is trying to send email</p>
  
  <pre><code>Errno::ECONNREFUSED
      Connection refused - connect(2)
  
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:546:in `initialize'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:546:in `open'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:546:in `tcp_socket'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:555:in `block in do_start'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:89:in `timeout'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:555:in `do_start'
  /Users/bhushan/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:525:in `start'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/mail-2.3.0/lib/mail/network/delivery_methods/smtp.rb:128:in `deliver!'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/mail-2.3.0/lib/mail/message.rb:1989:in `do_delivery'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/mail-2.3.0/lib/mail/message.rb:230:in `block in deliver'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/actionmailer-3.1.1/lib/action_mailer/base.rb:432:in `block in deliver_mail'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/notifications.rb:53:in `block in instrument'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/notifications.rb:53:in `instrument'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/actionmailer-3.1.1/lib/action_mailer/base.rb:430:in `deliver_mail'
  /Users/bhushan/.rvm/gems/ruby-1.9.2-p290/gems/mail-2.3.0/lib/mail/message.rb:230:in `deliver'
  /Users/bhushan/betterlabs_projects/companyplus_beta/cp_frontend/app/workers/set_crawling.rb:29:in `perform'
  </code></pre>
  
  <p>I have a file setup_mail.rb in initializers which has smtp settings</p>
  
  <pre><code> ActionMailer::Base.smtp_settings = {
   address: "smtp.gmail.com",
   port: 587,
   domain: 'betterlabs.net',  
   user_name: 'policemerepiche@gmail.com',
   password:
   authentication: 'plain',
   enable_starttls_auto: true
   }
  </code></pre>
  
  <p>and my mailer method </p>
  
  <pre><code>   def send_email(email)
  begin
  # attachments['result.csv'] = File.read(file)
   mail(to: "bhushanlodha@gmail.com", subject: "hey")
   puts "====Mail Sent===="
   rescue Exception=&gt;e
   puts e.inspect
   end
  end
  </code></pre>
  
  <p>development.rb</p>
  
  <pre><code>  config.action_mailer.delivery_method = :smtp
  </code></pre>
  
  <p>Any insight on what could be wrong? Thanks.</p>