module Roda::RodaPlugins::Mailer::InstanceMethods

def _mail_part(meth, body, headers=nil)

using the given body and optional headers.
Set the text_part or html_part (depending on the method) in the related email,
def _mail_part(meth, body, headers=nil)
  env[RODA_MAIL].send(meth) do
    body(body)
    headers(headers) if headers
  end
  nil
end

def _route

as the default content_type for the email.
If this is an email request, set the mail object in the response, as well
def _route
  if mail = env[RODA_MAIL]
    res = @_response
    res.mail = mail
    res.headers.delete(CONTENT_TYPE)
  end
  super
end