Sha256: d1aa7b5527f32d9ef0778462e6d2fadb9e5d23627155f2f5ddb773d1d583d2e0

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

module ExceptionAlarm
  class Mailer < ActionMailer::Base
    self.mailer_name = 'mailer'
    self.append_view_path "#{File.dirname(__FILE__)}/views"

    cattr_accessor :prefix
    cattr_accessor :sender
    cattr_accessor :recipients
    self.prefix = '[ERROR]'
    self.sender = 'exception@example.com'
    self.recipients = []

    def alarm(env, exception)
      @env = env
      @exception = exception
      @kontroller = env['action_controller.instance']
      @request = ActionDispatch::Request.new(env)

      mail(
        from: self.class.sender,
        to: self.class.recipients,
        subject: "#{self.class.prefix} (#{@exception.class}) #{@exception.message.inspect}"
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exception-alarm-1.0.0 lib/exception_alarm/mailer.rb