Class: DefraRubyEmail::TestMailer
- Inherits:
-
ActionMailer::Base
- Object
- ActionMailer::Base
- DefraRubyEmail::TestMailer
- Defined in:
- app/mailers/defra_ruby_email/test_mailer.rb
Constant Summary collapse
- FROM_ADDRESS =
"[email protected]"
Instance Method Summary collapse
- #html_email(recipient, add_logo = false) ⇒ Object
- #multipart_email(recipient, add_logo = false) ⇒ Object
- #text_email(recipient, add_logo = false) ⇒ Object
Instance Method Details
#html_email(recipient, add_logo = false) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/mailers/defra_ruby_email/test_mailer.rb', line 21 def html_email(recipient, add_logo = false) if add_logo mail( to: recipient, from: FROM_ADDRESS, subject: "HTML email" ) do |format| format.html { render html: "<h1>This is the html version of an email</h1>".html_safe } end end |
#multipart_email(recipient, add_logo = false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/mailers/defra_ruby_email/test_mailer.rb', line 8 def multipart_email(recipient, add_logo = false) if add_logo mail( to: recipient, from: FROM_ADDRESS, subject: "Multi-part email" ) do |format| format.html { render html: "<h1>This is the html version of an email</h1>".html_safe } format.text { render plain: "This is the text version of an email" } end end |
#text_email(recipient, add_logo = false) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/mailers/defra_ruby_email/test_mailer.rb', line 33 def text_email(recipient, add_logo = false) if add_logo mail( to: recipient, from: FROM_ADDRESS, subject: "Text email" ) do |format| format.text { render plain: "This is the text version of an email" } end end |