Rails3:邮件程序中的 ECONNREFUSED 错误
我在 Rails 3 应用程序中有一个控制器,在创建 WorkRequest 类型的新对象后,它会向请求者发送一封电子邮件。适用于除一名用户之外的所有用户。当她尝试时,我在服务器日志中收到以下内容。
Started POST "/work_requests" for 172.16.42.150 at Mon Aug 08 14:42:53 -0400 2011
Processing by WorkRequestsController#create as HTML
Parameters: {"commit"=>" Save ", "authenticity_token"=>"GhhZ6S0mBaju2zs5Fc7M+u5SoLCke5CRSdVCvLzMK1Q=", "utf8"=>"✓", "work_request"=>{"work_due_date"=>"2011-12-01", "person_id"=>"525", "status"=>"Pending", "last_request_date"=>"", "requester_id"=>"5", "pier_module_id"=>"223"}}
Rendered person_mailer/work_request_init_email.html.erb (2.4ms)
Rendered person_mailer/work_request_init_email.text.erb (1.8ms)
Sent mail to [email protected] (409ms)
Completed in 548ms
Errno::ECONNREFUSED (Connection refused - connect(2)):
app/controllers/work_requests_controller.rb:57:in `create'
app/controllers/work_requests_controller.rb:54:in `create'
它似乎已经发送了电子邮件(她今天离开了,所以我不能问她是否收到了),但是控制器中调用邮件程序的线路失败了,所以我不确定。
PersonMailer.work_request_init_email(@work_request).deliver
似乎无法找到有关 ECONNREFUSED 含义的任何可靠信息。是邮件服务器拒绝连接(在这种情况下为什么显示邮件已发送?),还是 Web 服务器在邮件发送后拒绝连接。
什么可能导致任一服务器拒绝与该特定用户的连接?
任何帮助将不胜感激。该应用程序的所有其他用户似乎都工作正常。
I have a controller in a Rails 3 app that, after creating a new object of type WorkRequest, sends an e-mail to the requester. Works for all of my users except one. When she tries it I get the following in the server log.
Started POST "/work_requests" for 172.16.42.150 at Mon Aug 08 14:42:53 -0400 2011
Processing by WorkRequestsController#create as HTML
Parameters: {"commit"=>" Save ", "authenticity_token"=>"GhhZ6S0mBaju2zs5Fc7M+u5SoLCke5CRSdVCvLzMK1Q=", "utf8"=>"✓", "work_request"=>{"work_due_date"=>"2011-12-01", "person_id"=>"525", "status"=>"Pending", "last_request_date"=>"", "requester_id"=>"5", "pier_module_id"=>"223"}}
Rendered person_mailer/work_request_init_email.html.erb (2.4ms)
Rendered person_mailer/work_request_init_email.text.erb (1.8ms)
Sent mail to [email protected] (409ms)
Completed in 548ms
Errno::ECONNREFUSED (Connection refused - connect(2)):
app/controllers/work_requests_controller.rb:57:in `create'
app/controllers/work_requests_controller.rb:54:in `create'
It appears to have sent the e-mail (she's left for the day so I can't ask if she received it) but the line it's failing on in the controller the line that invokes the mailer, so I'm not sure.
PersonMailer.work_request_init_email(@work_request).deliver
Can't seem to find any solid info on what ECONNREFUSED means. Is the mail server refusing the connect (in which case why does it appear the mail was sent?) or is the web server refusing to connect after the mail is sent.
What might cause either server to refuse a connection with this particular user?
Any help would be much appreciated. All the other users of the app seem to be working fine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这通常是由于与 SMTP 服务器的连接失败而导致的错误。我想说,请仔细检查环境文件中的设置(最有可能是 production.rb),并仔细检查电子邮件地址。您还可以检查 SMTP 服务器是否设置了限制。
This generally is an error caused by a failed connection to the SMTP server. I'd say double check your settings in your environment files (production.rb most likely) and double check the email address. You might also check to see if there's a limit set by the SMTP server.