Forum: Ruby on Rails EOF ERROR occurs when sending mail by ROR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
42cbd16ab4dfb01953f25e14de2d8ac1?d=identicon&s=25 Xuefeng Wang (xuefeng)
on 2006-01-08 09:10
I meet an EOF ERROR when I try to send a mail by Mailer class. This is
my error information. Could you please kindly tell me the reason for it
and how to deal with it. Thank you.
-------------------------------

 EOFError in Order#confirm

End of file reached

RAILS_ROOT: ./script/../config/../
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/1.8/net/protocol.rb:197:in `sysread'
c:/ruby/lib/ruby/1.8/net/protocol.rb:197:in `rbuf_fill'
c:/ruby/lib/ruby/1.8/net/protocol.rb:196:in `timeout'
c:/ruby/lib/ruby/1.8/timeout.rb:55:in `timeout'
c:/ruby/lib/ruby/1.8/net/protocol.rb:196:in `rbuf_fill'
c:/ruby/lib/ruby/1.8/net/protocol.rb:160:in `readuntil'
c:/ruby/lib/ruby/1.8/net/protocol.rb:171:in `readline'
c:/ruby/lib/ruby/1.8/net/smtp.rb:664:in `recv_response'
c:/ruby/lib/ruby/1.8/net/smtp.rb:396:in `do_start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:396:in `critical'
c:/ruby/lib/ruby/1.8/net/smtp.rb:396:in `do_start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:436:in
`perform_delivery_smtp'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:327:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:327:in
`deliver!'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-1.1.5/lib/action_mailer/base.rb:254:in
`deliver'
#{RAILS_ROOT}app/controllers/order_controller.rb:11:in `confirm'
42cbd16ab4dfb01953f25e14de2d8ac1?d=identicon&s=25 Xuefeng Wang (xuefeng)
on 2006-01-09 02:08
I think this is a problem of environment.rb. But when I try to run the
sample code of book "Agile Web Development by Ruby on Rails final", it
can't work either.
A5fe8e4084e903539f5a8429862d970c?d=identicon&s=25 Michal Wronka (Guest)
on 2006-07-08 19:04
Hello

I tried answering this problem on different thread:
http://www.ruby-forum.com/topic/53991#32200

In any case, try sending email directly via smtp to check your
configuration (for example by running code below)
--sample code--
msgstr = <<END_OF_MESSAGE
From: <from@server.com>
To: <to@server.com>
Subject: Test
Date: #{Time.now}

Test
END_OF_MESSAGE

Net::SMTP.start('smtp.server.com', 25, 'server.com', 'from',
'secret_password', :plain ) do |smtp|
  smtp.send_message msgstr,
  'from@server.com',
  'to@server.com'
end
--end of sample code--

My smtp server was checking whether 'from@server.com' was the same in
all places , as shown in code above. If 'From' field in the mail was
different - EOFError was raised. (More details in the other thread).
This topic is locked and can not be replied to.