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