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 247 def initialize(env) 248 super 249 if mail = env['roda.mail'] 250 res = @_response 251 res.mail = mail 252 res.headers.delete(RodaResponseHeaders::CONTENT_TYPE) 253 end 254 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 259 def add_file(*a, &block) 260 response.mail_attachments << [a, block] 261 nil 262 end
no_mail!()
Signal that no mail should be sent for this request.
[show source]
# File lib/roda/plugins/mailer.rb 265 def no_mail! 266 throw :no_mail 267 end