使用OS X,尝试使用Rails Exception Notifier插件发送电子邮件。我已经验证了以下内容:
1/0
)。安装了当前插件......
脚本/插件安装git://github.com/rails/exception_notification.git
在ApplicationController中......
包括ExceptionNotifiable
local_addresses.clear
在environment.rb ...
Rails::Initializer.run do |config|
# ...
config.after_initialize do
ExceptionNotifier.exception_recipients = %w(abc@gmail.com abc@abc.gov)
ExceptionNotifier.sender_address = %("Contact DB error" <abc@abc.gov>)
ExceptionNotifier.email_prefix = "[Contact DB error] "
end
end
除了故意创建的测试错误,我在控制台上看到了这个错误...
Processing ApplicationController#index (for 127.0.0.1 at 2009-10-02 14:40:55) [GET]
Net::SMTPFatalError (555 5.5.2 Syntax error. 3sm30577fge.12
):
/usr/local/lib/ruby/1.8/net/smtp.rb:680:in `check_response'
/usr/local/lib/ruby/1.8/net/smtp.rb:653:in `getok'
/usr/local/lib/ruby/1.8/net/smtp.rb:631:in `mailfrom'
/usr/local/lib/ruby/1.8/net/smtp.rb:544:in `send0'
/usr/local/lib/ruby/1.8/net/smtp.rb:472:in `sendmail'
/usr/local/lib/ruby/1.8/net/smtp.rb:379:in `start'
haml (2.2.6) rails/./lib/sass/plugin/rails.rb:19:in `process'
然后它尝试发送SMTP错误的异常通知......
Subject: [Contact DB error] application#index (Net::SMTPFatalError) "555 5.5.2 Syntax error. 3sm30577fge.12\n"