Module: Roda::RodaPlugins::ErrorEmail::InstanceMethods
- Defined in:
- lib/roda/plugins/error_email.rb
Instance Method Summary collapse
-
#error_email(e) ⇒ Object
Send an email for the given error.
Instance Method Details
#error_email(e) ⇒ Object
Send an email for the given error.
95 96 97 98 99 100 101 102 103 |
# File 'lib/roda/plugins/error_email.rb', line 95 def error_email(e) email_opts = self.class.opts[:error_email].dup headers = email_opts[:default_headers].call(email_opts, e) headers = Hash[headers].merge!(email_opts[:headers]) headers = headers.map{|k,v| "#{k}: #{v.gsub(/\r?\n/m, "\r\n ")}"}.sort.join("\r\n") body = email_opts[:body].call(self, e) email_opts[:message] = "#{headers}\r\n\r\n#{body}" email_opts[:emailer].call(email_opts) end |