我正在使用带有 ActionMailer 的 Rails 3.2 来发送电子邮件通知。
我在 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 帐户。