Public Class methods
new(env)
If this is an email request, set the mail object in the response, as well as the default content_type for the email.
[show source]
# File lib/roda/plugins/mailer.rb 249 def initialize(env) 250 super 251 if mail = env['roda.mail'] 252 res = @_response 253 res.mail = mail 254 res.headers.delete(RodaResponseHeaders::CONTENT_TYPE) 255 end 256 end
Public Instance methods
add_file(*a, &block)
Delay adding a file to the message until after the message body has been set. If a block is given, the block is called after the file has been added, and you can access the attachment via response.mail_attachments.last.
[show source]
# File lib/roda/plugins/mailer.rb 261 def add_file(*a, &block) 262 response.mail_attachments << [a, block] 263 nil 264 end
no_mail!()
Signal that no mail should be sent for this request.
[show source]
# File lib/roda/plugins/mailer.rb 267 def no_mail! 268 throw :no_mail 269 end