module Roda::RodaPlugins::Mailer::InstanceMethods
def _mail_part(meth, body, headers=nil)
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'].public_send(meth) do body(body) headers(headers) if headers end nil end
def add_file(*a, &block)
If a block is given, the block is called after the file has been added, and you
Delay adding a file to the message until after the message body has been set.
def add_file(*a, &block) response.mail_attachments << [a, block] nil end
def initialize(env)
If this is an email request, set the mail object in the response, as well
def initialize(env) super if mail = env['roda.mail'] res = @_response res.mail = mail res.headers.delete(RodaResponseHeaders::CONTENT_TYPE) end end
def no_mail!
def no_mail! throw :no_mail end