ActionMailer出现意外的EOFError

时间:2013-04-10 09:39:13

标签: ruby-on-rails smtp actionmailer

我正在使用Rails 3.2和ActionMailer发送电子邮件通知。

我在GoDaddy购买了电子邮件。

我也在使用Gmail帐户进行测试。

在我的development.rb中,我通常在使用Gmail帐户时以这种方式配置电子邮件

  # config.action_mailer.smtp_settings = {
  #           :enable_starttls_auto => true,
  #           :address => "smtp.gmail.com",
  #           :port => "587",
  #           :domain => "google.com",
  #           :authentication => :plain,
  #           :user_name => "MY_USER_NAME",
  #           :password => "MY_PASSWORD"
  #   }

使用Gmail一切正常,并且始终没有问题。

现在,当我配置GoDaddy帐户时,我是偶然,收到EOF Error消息时没有更多信息

  config.action_mailer.smtp_settings = {
          #:enable_starttls_auto => true,
          :address => "smtpout.europe.secureserver.net",
          :port => 80,
          :domain => "MY_DOMAIN.COM",
          :authentication => :plain,
          :user_name => "MY_USERNAME",
          :password => "MY_PASSWORD"
  }

我的问题是它确实有效,但有时候,我不知道为什么,它没有给我一个EOF错误信息。

这是来自控制台的错误日志

  ...

  Rendered user_mailer/service_notification_email.html.erb (44.6ms)
  Rendered user_mailer/service_notification_email.text.erb (0.4ms)

Sent mail to receiver@domain.com (1497ms)
Date: Wed, 10 Apr 2013 11:31:44 +0200
From: support@my_domain.com
To: joel.maranhao@gmail.com
Message-ID: <516531804e7a_8a23fbfc5c34ec4299fa@joel-maranhaos-imac.local.mail>
Subject: My application notification - Testing
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_5165317fc70c3_8a23fbfc5c34ec429616";
 charset=UTF-8
Content-Transfer-Encoding: 7bit



----==_mimepart_5165317fc70c3_8a23fbfc5c34ec429616
Date: Wed, 10 Apr 2013 11:31:43 +0200
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <5165317fe1356_8a23fbfc5c34ec4297a6@joel-maranhaos-imac.local.mail>

Service notification
=======================================    

Testing

hello

New service created

----==_mimepart_5165317fc70c3_8a23fbfc5c34ec429616
Date: Wed, 10 Apr 2013 11:31:43 +0200
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <5165317ff08e6_8a23fbfc5c34ec4298f2@joel-maranhaos-imac.local.mail>

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <link href='http://twitter.github.com/bootstrap/assets/css/bootstrap.css' rel='stylesheet' />
  </head>
  <body>
    <div class="container">

    <h1>Testing by Buyer</h1>

    <p>hello</p>

    <h2>Notice</h2>
    <p>New service created</p>
    </div>
  </body>
</html>

----==_mimepart_5165317fc70c3_8a23fbfc5c34ec429616--

   (0.3ms)  ROLLBACK
Completed 500 Internal Server Error in 3282ms

EOFError (end of file reached):
  app/models/creative_service.rb:49:in `new_service'
  app/controllers/creative_services_controller.rb:80:in `block in create'
  app/controllers/creative_services_controller.rb:79:in `create'
  config/initializers/quiet_assets.rb:7:in `call_with_quiet_assets'


  Rendered /Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
  Rendered /Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
  Rendered /Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.11/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (13.8ms)

关于如何解决这个问题的任何想法? 我不确定EOF(文件末尾到达)告诉我什么,因为它适用于Gmail帐户。

1 个答案:

答案 0 :(得分:-1)

给GoDaddy注册的电子邮件帐户,如support@yourwebsite.com,或者如果MY_USERNAME是电子邮件,则将MY_USERNAME作为您的发件人地址。 它为我工作。希望它适合你。