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