I use Exception Notifier for handling errors in my app and in /config/initializers/exception_notification.rb I have followings:
MyAPP::Application.config.middleware.use ExceptionNotifier,
:email_prefix => "[ERROR] ",
:sender_address => '"Notifier" <notifier@yourdomain.com>',
:exception_recipients => ['account@gmail.com']
But the notification email is sent also in development mode, how can I allow sending email only in production mode?
You can configure the ExceptionNotifier separately for each environment. See also the documentation.
So you just configure it in your
config/environments/production.rbwith e.g.There is also a nice blog entry handling this topic.