rack-mail-exceptions-notification-middleware

I’m working on my small project devz.info - a sinatra powered app. And by nature I wanted to have exceptions delivered to my mailbox same way as exception_notification rails plugin does.

But mailexceptions middleware for rack didn’t really work for TLS enabled smtp, so I contributed patch and it has been applied!

Here’s sample config.ru

require 'rack'
require 'rack/contrib'

use  Rack::MailExceptions.new do |mail|
  mail.to 'foo@example.org'
  mail.from 'bar@example.org'
  mail.subject '[ERROR] %s'
  mail.smtp { :server         => 'smtp.gmail.com',
              :domain         => 'gmail.com',
              :port           => 587,
              :authentication => 'plain',
              :user_name      => 'your_user',
              :password       => 'your_pass'}
end

run lambda {|env| raise 'whoops' }

see tests for more.

Comments