Sha256: d8d8baad4886e240252872583ed04265d99a7e818d701b87680c4a73f20439e9

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

class Mailer < ActionMailer::Base
  def multipart
    @recipients = "mutomasa@gmail.com"
    @from = "mutomasa@gmail.com"
    @subject = _("multipart test mail")
    @sent_on = Time.gm("2007-01-01 00:00:00")
    @mime_version = "1.0"
    @body = nil
    @charset = nil
    @content_type = "multipart/mixed"

    attachments = Dir.glob("#{RAILS_ROOT}/public/images/*").select{|f| File.file?(f)}

    part(:content_type => "text/plain", :charset => "iso-2022-jp") do |coverpage|
      coverpage.body = render_message("coverpage", :name => "foo")
      coverpage.transfer_encoding = "7bit"
    end

    attachments.each do |attachment|
      attachment "application/octet-stream" do |attach|
        attach.content_disposition = "attachment"
        attach.charset = nil
        attach.filename = File.basename(attachment)
        attach.transfer_encoding = "base64"
        attach.body = File.read(attachment)
      end
    end
    @body
  end

  def singlepart
    recipients "mutomasa@gmail.com"
    from "mutomasa@gmail.com"
    subject _("singlepart test mail")
    sent_on Time.gm("2007-01-01 00:00:00")
    body["name"] = "foo"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gettext_rails-2.1.0 test/app/models/mailer.rb
gettext_rails-2.0.0 test/app/models/mailer.rb
gettext_rails-2.0.1 test/app/models/mailer.rb
gettext_rails-2.0.2 test/app/models/mailer.rb
gettext_rails-2.0.3 test/app/models/mailer.rb
gettext_rails-2.0.4 test/app/models/mailer.rb