Sha256: 8cd085866f51df56ea31ab97d6d90f02af07b27bdb80260249d9caec36667882
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
class TestMailer < ActionMailer::Base def plain_text_message(options) setup = setup_recipients(options) mail({from: 'test@mailsafe.org', subject: "Plain text Message Test"}.update(setup)) do |format| format.text { render text: "Here is the message body." } end end def html_message(options) setup = setup_recipients(options) body = "<p>Here is the message body.</p>" body = body.html_safe if body.respond_to?(:html_safe) mail({from: 'test@mailsafe.org', subject: "Html Message Test"}.update(setup)) do |format| format.html { render text: body } end end def multipart_message(options) setup = setup_recipients(options) html_body = "<p>Here is the message body.</p>" html_body = html_body.html_safe if html_body.respond_to?(:html_safe) mail({from: 'test@mailsafe.org', subject: "Html Message Test"}.update(setup)) do |format| format.text { render text: "Here is the message body." } format.html { render text: html_body } end end protected def setup_recipients(options) options.select { |k,_| [:to, :cc, :bcc].include? k } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail_safe-0.3.2 | spec/mailers/test_mailer.rb |