Sha256: 49d9bda5ac9d6611238d66a33d8ad7200cda3c372056b4f55fb514d5ea297bb4
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
module ActionMailer # Accessors and helpers that ActionMailer::Base and ActionMailer::Part have # in common. Using these helpers you can easily add subparts or attachments # to your message: # # def my_mail_message(...) # ... # part "text/plain" do |p| # p.body "hello, world" # p.transfer_encoding "base64" # end # # attachment "image/jpg" do |a| # a.body = File.read("hello.jpg") # a.filename = "hello.jpg" # end # end module PartContainer # The list of subparts of this container attr_reader :parts # Add a part to a multipart message, with the given content-type. The # part itself is yielded to the block, so that other properties (charset, # body, headers, etc.) can be set on it. def part(params) params = {:content_type => params} if String === params part = Part.new(params) yield part if block_given? @parts << part end # Add an attachment to a multipart message. This is simply a part with the # content-disposition set to "attachment". def attachment(params, &block) params = { :content_type => params } if String === params params = { :disposition => "attachment", :transfer_encoding => "base64" }.merge(params) part(params, &block) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
actionmailer-1.1.2 | lib/action_mailer/part_container.rb |
actionmailer-1.1.1 | lib/action_mailer/part_container.rb |