Class: DefraRubyEmail::TestMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/defra_ruby_email/test_mailer.rb

Constant Summary collapse

FROM_ADDRESS =
"[email protected]"

Instance Method Summary collapse

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,  = false)
  add_logo_attachment if 

  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,  = false)
  add_logo_attachment if 

  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,  = false)
  add_logo_attachment if 

  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