Ruby 邮件程序出现 EOFError [英] Ruby mailer is coming up with an EOFError

查看:34
本文介绍了Ruby 邮件程序出现 EOFError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在控制器中的此代码上收到 EOFError(文件结束错误).出现错误的块位于 UserMailer.deliver_message( 我不知道如何解决此问题的行的末尾,我已经卡了大约 2 个月,建议使用此站点.请帮忙.

I am getting an EOFError (End Of File Error) on this code in my controller. The block where the error appears is at the end of the line that says UserMailer.deliver_message( I am unaware as to how to fix this, I have been stuck for about 2 months and this site was suggested. Please help.

  def contact
      @title= "Contact Us"
      if request.post?
       @message= Message.new(params[:contact])
        if @message.valid?
           UserMailer.deliver_message(
            :message => @message
            )
          flash[:notice] = "Thank you for contacting us"
          redirect_to contact_url
         end
        end
      end

这是消息文件:

<%= @message.name %> has sent feedback or a question:

  Message: <%= @message.body %>

  From: <%= @message.email %>

这里是 UserMailer

And here is the UserMailer

class UserMailer < ActionMailer::Base

  def message(mail)
    subject    'Feedback/Questions'
    recipients 'Email@email'
    from       'webmaster'
    body        mail
  end
end

好吧,这是我得到的错误

Alright here is the error I get

PedalsController#contact 中的 EOFError

EOFError in PedalsController#contact

到达文件末尾

这是应用程序跟踪

/usr/lib64/ruby/1.8/net/protocol.rb:135:in `sysread'
/usr/lib64/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
/usr/lib64/ruby/1.8/timeout.rb:62:in `timeout'
/usr/lib64/ruby/1.8/timeout.rb:93:in `timeout'
/usr/lib64/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/lib64/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/lib64/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/lib64/ruby/1.8/net/smtp.rb:911:in `recv_response'
/usr/lib64/ruby/1.8/net/smtp.rb:897:in `getok'
/usr/lib64/ruby/1.8/net/smtp.rb:921:in `critical'
/usr/lib64/ruby/1.8/net/smtp.rb:895:in `getok'
/usr/lib64/ruby/1.8/net/smtp.rb:828:in `mailfrom'
/usr/lib64/ruby/1.8/net/smtp.rb:653:in `sendmail'
$HOME/blueflower/vendor/rails/actionmailer/lib/action_mailer/base.rb:684:in `perform_delivery_smtp'
/usr/lib64/ruby/1.8/net/smtp.rb:526:in `start'
$HOME/blueflower/vendor/rails/actionmailer/lib/action_mailer/base.rb:682:in `perform_delivery_smtp'
$HOME/blueflower/vendor/rails/actionmailer/lib/action_mailer/base.rb:523:in `__send__'
$HOME/blueflower/vendor/rails/actionmailer/lib/action_mailer/base.rb:523:in `deliver!'
$HOME/blueflower/vendor/rails/actionmailer/lib/action_mailer/base.rb:395:in `method_missing'
$HOME/blueflower/app/controllers/pedals_controller.rb:36:in `contact'

<小时>

也许我错过了一些非常愚蠢的东西,但如果有人能回答这个问题,那就太棒了.另外,我的解决方法是什么?


Maybe I am missing something really stupid, but if someone can answer this, that would be amazing. Also, what is my fix?

推荐答案

好的,谢谢大家,其实我在 UserMailer 中的代码格式错误.我在 from 行中的实际代码有一个 <> 包含一个电子邮件地址,并且在外面有发件人姓名.虽然这在我使用/工作的一些私人电子邮件服务器上有效,但它不适用于 Hostmonster.所以,对于将来最终使用 Hostmonster 的任何人,请保持邮件配置的一切简单(消息可能很复杂,但 SMTP 配置需要简单).谢谢.

Alright, thank you guys, I actually had malformed code in the UserMailer. The actual code I had in the from line had a <> encasing an email address and had the senders name on the outside. Though that has worked on some of the private email servers I have used/work on, it does not work on Hostmonster. Soo, for anyone that ends up using Hostmonster in the future, keep everything about your mailers configuration simple (the message can be complicated but the SMTP Config needs to be simple). Thanks.

这篇关于Ruby 邮件程序出现 EOFError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆