Ruby Mailer提出了EOFError [英] Ruby mailer is coming up with an EOFError

查看:158
本文介绍了Ruby Mailer提出了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中的EOF错误

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 Config必须很简单)。谢谢。

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 Mailer提出了EOFError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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