Help regarding sending email

I have rails space application running on my local.
I have issues in sending emails on my application.

I have configured my environment.rb as follows :

config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_charset = "utf-8"
ActionMailer::Base.smtp_settings = {:address
=>"smtp.mail.yahoo.co.in",
:port => 587,
:domain => "yahoo.com",
:authentication => :login,
:user_name => "*******@yahoo.com",
:password => '******'}

But when I run the application I am getting the following error : -

Errno::EBADF (Bad file descriptor - connect(2)):
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:207:in
`initialize'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:207:in
`new'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:207:in
`old_open'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:207:in
`old_open'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:393:in
`do_start'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
actionmailer-2.0.2/lib/action_mailer/base.rb:586:in
`perform_delivery_smtp'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
actionmailer-2.0.2/lib/action_mailer/base.rb:469:in `__send__'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
actionmailer-2.0.2/lib/action_mailer/base.rb:469:in `deliver!'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
actionmailer-2.0.2/lib/action_mailer/base.rb:352:in `method_missing'
    /app/controllers/email_controller.rb:9:in `remind'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/base.rb:1158:in `send'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/base.rb:1158:in `perform_action_without_filters

    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/filters.rb:697:in `call_filters'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/filters.rb:689:in `perform_action_without_bench
ark'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/benchmarking.rb:68:in `perform_action_without_r
scue'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
`measure'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/benchmarking.rb:68:in `perform_action_without_r
scue'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/rescue.rb:199:in `perform_action_without_cachin
'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/caching.rb:678:in `perform_action'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
query_cache.rb:33:in
`cache'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/caching.rb:677:in `perform_action'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/base.rb:524:in `send'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/base.rb:524:in `process_without_filters'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/filters.rb:685:in `process_without_session_mana
ement_support'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/session_management.rb:123:in `process'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/base.rb:388:in `process'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/dispatcher.rb:171:in `handle_request'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/dispatcher.rb:115:in `dispatch'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/
lib/action_controller/dispatcher.rb:9:in `dispatch'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/bin/../lib/mongrel/rails.rb:76:in `process'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/bin/../lib/mongrel/rails.rb:74:in `synchronize'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/bin/../lib/mongrel/rails.rb:74:in `process'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:159:in `process_client'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:158:in `each'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:158:in `process_client'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:285:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:285:in `initialize'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:285:in `new'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:285:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:268:in `initialize'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:268:in `new'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel.rb:268:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel/configurator.rb:282:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel/configurator.rb:281:in `each'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel/configurator.rb:281:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/bin/mongrel_rails:128:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/lib/mongrel/command.rb:212:in `run'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-
mswin32/bin/mongrel_rails:281
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/
commands/servers/mongrel.rb:64
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `gem_original_require'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `require'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/
activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/
commands/server.rb:39
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `gem_original_require'
    C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `require'
    script/server:3

Could any body help me regarding this issue. In case you require any
further information please do inform me.

Thank you.

That errors is due to a timeout experienced by ActionMailer trying to connect to the smtp server. ActionMailer doesnt’ work with SSL/TLS authentication. Read this link for more information.

http://www.rubyinside.com/how-to-use-gmails-smtp-server-with-rails-394.html

Thank you very much Andresr83.

But when I do using that I am getting

execution expired

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/timeout.rb:54:in `open'

lib/smtp_tls.rb:10:in `do_start'
lib/smtp_tls.rb:10:in `do_start'
app/controllers/email_controller.rb:9:in `remind'

But I am able to see body of the email send when you look at the command propmt.

I am using windows OS and currently behing corporate firewall. Could these be the reasons
why I am not allowed to send mails ?

Any help would you greatly appreciated.

Well windows + firewall is a bad combination. You can try to deploy your project in a clean environment or find a solution to your "

execution expired" error via google.

I am trying googling it for a long time. But I am not getting any valid results.
I will continue to look and post any information I get on this …
Thanks for your help once more Andresr83.

Hello all,

I tried changing the setting of smpt and now I am getting error :

That is almost certainly the wrong setting for :domain. That is the
domain used in the helo or ehlo command, and it is supposed to be the
domain name associated with your computer. Claiming to be yahoo.com
could easily result in the smtp server thinking you are being
fraudulent. You're probably better off not specifying it than
specifying something bogus. The :authentication might be wrong too,
possible values are :plain, :login, :cram_md5

Fred

I tried to change the DOMAIN name . Now I am recieving End Of File reached error.

getaddrinfo: no address associated with hostname.
lib/smtp_tls.rb:10:in `initialize'

lib/smtp_tls.rb:10:in `open'
lib/smtp_tls.rb:10:in `do_start'
lib/smtp_tls.rb:10:in `do_start'
app/controllers/email_controller.rb:10:in `remind'

Email Senders in distress,

"getaddrinfo: no address associated with hostname. "

Likely now ruby/smtp is trying to do a DNS lookup on the domain you
provided. So if you made a hostname that actual does not resolve to
anything it will get upset. The simplest thing to do is add the new
domain to your "hosts" file. Which in Windows is in this directory
within "system32" /drivers/etc/hosts. Add a line for you computer/
domain name:

example:
192.168.1.2 nicedell.localhost

But this is just the start of your problems. Getting the email to
yahoo's SMTP servers is about as far as the email will get. Yahoo is
going to be VERY,VERY strict about allowing you to send email from a
random computer it's never received email from. Secondly, your actual
IP address at your gateway is what Yahoo will see as the sending
source IP and this won't match your envelope nor match the sending
domain. All of this headache is for defending against SPAM bots and
the like.

You need to do some reading about these email authentication schemes:

SenderID
SPF
Domain Keys

Hank

Thank you all so much for those suggestions.

I have changed the settings of my SMTP. But now I get

getaddrinfo: servname not supported for ai_socktype.

:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:209:in `initialize'

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:209:in `new'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:209:in `old_open'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/protocol.rb:209:in `old_open'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:393:in `do_start'

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:586:in `perform_delivery_smtp'

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:469:in `__send__'
C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:469:in `deliver!'

C:/PROGRA~1/BITNAM~1/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:352:in `method_missing'
app/controllers/email_controller.rb:10:in `remind'