module Roda::RodaPlugins::ErrorEmail::InstanceMethods

def error_email_content(exception)

Takes the same argument as #error_email.
The content of the email to send, include the headers and the body.
def error_email_content(exception)
  email_opts = self.class.opts[:error_email]
  headers = email_opts[:default_headers].call(email_opts, exception)
  headers = 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, exception)
  "#{headers}\r\n\r\n#{body}"
end