Sha256: e3cdcd49e8d2b67c08d82f96c4d260c0d5b587410038d2cab5c7eaa7c889860c
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
class TestMailer < ActionMailer::Base # template root must be set for multipart emails, or ActionMailer will throw an exception. if ActionMailer::VERSION::MAJOR == 2 self.template_root = File.dirname(__FILE__) end def plain_text_message(options) setup_recipients(options) from 'test@mailsafe.org' subject "Plain text Message Test" body "Here is the message body." end def html_message(options) setup_recipients(options) from 'test@mailsafe.org' subject "Html Message Test" body "<p>Here is the message body.</p>" content_type 'text/html' body(body.html_safe) if body.respond_to?(:html_safe) end def multipart_message(options) setup_recipients(options) from 'test@mailsafe.org' subject "Html Message Test" content_type 'multipart/alternative' part :content_type => 'text/plain', :body => "Here is the message body." html_body = "<p>Here is the message body.</p>" html_body = html_body.html_safe if html_body.respond_to?(:html_safe) part :content_type => 'text/html', :body => html_body end protected def setup_recipients(options) recipients options[:to] cc options[:cc] bcc options[:bcc] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail_safe-0.3.1 | spec/mailers/test_mailer.rb |