Class: Rack::MailExceptions

Inherits:
Object
  • Object
show all
Defined in:
lib/config/config_ru.rb

Instance Method Summary collapse

Instance Method Details

#send_notification(exception, env) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/config/config_ru.rb', line 28

def send_notification(exception, env)
  mail = generate_mail(exception, env)
  smtp = config[:smtp]
  env['mail.sent'] = true
  return if smtp[:server] == 'example.com'

  Net::SMTP.start smtp[:server], smtp[:port], smtp[:domain], smtp[:user_name], smtp[:password], smtp[:authentication] do |server|
    mail.to.each do |recipient|
      server.send_message mail.to_s, mail.from, recipient
    end
  end
end