Ruby邮件程序正在提出一个EOFError

时间:2022-12-05 22:57:54

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.

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

  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

Here is the message file:

这是消息文件:

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

  Message: <%= @message.body %>

  From: <%= @message.email %>

And here is the UserMailer

这是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

好吧,这是我得到的错误


EOFError in PedalsController#contact

PedalsController中的EOFError #contact

end of file reached

到达文件的末尾


and here is the application trace

这是应用程序跟踪


/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?

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

5 个解决方案

#1


15  

This can also happen if the SMTP server is down. (I use a 3rd party mailer called Sendgrid and this happened once when it goes down entirely)

如果SMTP服务器关闭,也会发生这种情况。 (我使用名为Sendgrid的第三方邮件程序,当它完全关闭时发生了一次)

#2


9  

If you are using "ZOHO" to send email,

如果您使用“ZOHO”发送电子邮件,

one of the reason I had a problem with this was.

我遇到问题的原因之一是。

  1. You should use a valid from value. In my case, I used a non existing email account default from: "info@luxelectrical.net.au" hence zoho server is not allowing the email to be sent which causes EOF Error.
  2. 您应该使用有效的值。在我的情况下,我使用了一个不存在的电子邮件帐户默认来自:“info@luxelectrical.net.au”因此zoho服务器不允许发送导致EOF错误的电子邮件。
  3. You should allow IMAP settings on ZOHO Ruby邮件程序正在提出一个EOFError
  4. 您应该在ZOHO上允许IMAP设置

#3


3  

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.

好的,谢谢你们,我实际上在UserMailer中有错误的代码。我在起始行中的实际代码有一个<>包含一个电子邮件地址,并在外面有发件人姓名。虽然这已经在我使用/工作的一些私人电子邮件服务器上有效,但它在Hostmonster上不起作用。 Soo,对于将来最终使用Hostmonster的任何人来说,保持邮件配置的一切都很简单(邮件可能很复杂,但SMTP配置需要简单)。谢谢。

#4


1  

Do you have to authenticate to the mail server?

您是否需要对邮件服务器进行身份验证?

:authentication => :plain (if so), :enable_starttls_auto => true

:authentication =>:plain(如果是这样),: enable_starttls_auto => true

#5


0  

It's a problem with your SMTP.

这是你的SMTP的一个问题。

The mailer connect by SMTP to him and can't close corretly the socket.

邮件程序通过SMTP连接到他,无法正确关闭套接字。

#1


15  

This can also happen if the SMTP server is down. (I use a 3rd party mailer called Sendgrid and this happened once when it goes down entirely)

如果SMTP服务器关闭,也会发生这种情况。 (我使用名为Sendgrid的第三方邮件程序,当它完全关闭时发生了一次)

#2


9  

If you are using "ZOHO" to send email,

如果您使用“ZOHO”发送电子邮件,

one of the reason I had a problem with this was.

我遇到问题的原因之一是。

  1. You should use a valid from value. In my case, I used a non existing email account default from: "info@luxelectrical.net.au" hence zoho server is not allowing the email to be sent which causes EOF Error.
  2. 您应该使用有效的值。在我的情况下,我使用了一个不存在的电子邮件帐户默认来自:“info@luxelectrical.net.au”因此zoho服务器不允许发送导致EOF错误的电子邮件。
  3. You should allow IMAP settings on ZOHO Ruby邮件程序正在提出一个EOFError
  4. 您应该在ZOHO上允许IMAP设置

#3


3  

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.

好的,谢谢你们,我实际上在UserMailer中有错误的代码。我在起始行中的实际代码有一个<>包含一个电子邮件地址,并在外面有发件人姓名。虽然这已经在我使用/工作的一些私人电子邮件服务器上有效,但它在Hostmonster上不起作用。 Soo,对于将来最终使用Hostmonster的任何人来说,保持邮件配置的一切都很简单(邮件可能很复杂,但SMTP配置需要简单)。谢谢。

#4


1  

Do you have to authenticate to the mail server?

您是否需要对邮件服务器进行身份验证?

:authentication => :plain (if so), :enable_starttls_auto => true

:authentication =>:plain(如果是这样),: enable_starttls_auto => true

#5


0  

It's a problem with your SMTP.

这是你的SMTP的一个问题。

The mailer connect by SMTP to him and can't close corretly the socket.

邮件程序通过SMTP连接到他,无法正确关闭套接字。