module Roda::RodaPlugins::Mailer::ClassMethods

  1. lib/roda/plugins/mailer.rb

Methods

Public Instance

  1. mail
  2. sendmail

Public Instance methods

mail(path, *args)
Return a Mail::Message instance for the email for the given request path
and arguments.   Any arguments given are yielded to the appropriate +r.mail+
block after any usual match block arguments. You can further manipulate the

returned mail object before calling deliver to send the mail.

[show source]
    # File lib/roda/plugins/mailer.rb
145 def mail(path, *args)
146   mail = ::Mail.new
147   catch(:no_mail) do
148     unless mail.equal?(new("PATH_INFO"=>path, 'SCRIPT_NAME'=>'', "REQUEST_METHOD"=>"MAIL", 'rack.input'=>StringIO.new, 'roda.mail'=>mail, 'roda.mail_args'=>args)._roda_handle_main_route)
149       raise Error, "route did not return mail instance for #{path.inspect}, #{args.inspect}"
150     end
151     mail
152   end
153 end
sendmail(*args)

Calls mail with given arguments and immediately sends the resulting mail.

[show source]
    # File lib/roda/plugins/mailer.rb
156 def sendmail(*args)
157   if m = mail(*args)
158     m.deliver
159   end
160 end