module Roda::RodaPlugins::ErrorEmail::InstanceMethods

Public Instance Methods

error_email(e) click to toggle source

Send an email for the given error.

# File lib/roda/plugins/error_email.rb, line 96
def error_email(e)
  email_opts = self.class.opts[:error_email].dup
  headers = email_opts[:default_headers].call(email_opts, e)
  headers = headers.merge(email_opts[:headers])
  headers = headers.map{|k,v| "#{k}: #{v}"}.sort.join("\n")
  body = email_opts[:body].call(self, e)
  email_opts[:message] = "#{headers}\n\n#{body}"
  email_opts[:emailer].call(email_opts)
end