module Roda::RodaPlugins::MailProcessor::InstanceMethods
def after_mail_hook
Hook called after processing any mail, whether the mail was
def after_mail_hook nil end
def handled_mail_hook
Hook called after processing a mail, when the mail was handled.
def handled_mail_hook nil end
def mail
def mail env['roda.mail'] end
def mail_recipients
The recipients of the mail instance being processed, uses the To and CC
def mail_recipients Array(to) + Array(cc) end
def mail_text
The text of the mail instance being processed, uses the
def mail_text mail.body.decoded end
def process_mail(&block)
routes defined via the class-level +rcpt+ method, and then the
Perform the processing of mail for this request, first considering
def process_mail(&block) if string_routes = opts[:mail_processor_string_routes] addresses = mail_recipients addresses.each do |address| if meth = string_routes[address.to_s.downcase] _roda_handle_route{send(meth, @_request)} return end end opts[:mail_processor_regexp_routes].each do |regexp, meth| addresses.each do |address| if md = regexp.match(address) _roda_handle_route{send(meth, @_request, *md.captures)} return end end end end _roda_handle_main_route nil end
def unhandled_mail(reason)
mail as not handled. A reason why the mail was not handled must be
Raise an UnhandledMail exception with the given reason, used to mark the
def unhandled_mail(reason) raise UnhandledMail, reason end
def unhandled_mail_hook
Reraises the UnhandledMail exception raised during mail processing
Hook called after processing a mail, when the mail was not handled.
def unhandled_mail_hook raise end