class BaseMailer

Public Instance Methods

attachment_with_content(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 37
def attachment_with_content(hash = {})
  attachments["invoice.pdf"] = "This is test File content"
  mail(hash)
end
attachment_with_hash() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 42
def attachment_with_hash
  attachments["invoice.jpg"] = { data: ::Base64.encode64("\312\213\254\232)b"),
                                 mime_type: "image/x-jpg",
                                 transfer_encoding: "base64" }
  mail
end
attachment_with_hash_default_encoding() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 49
def attachment_with_hash_default_encoding
  attachments["invoice.jpg"] = { data: "\312\213\254\232)b",
                                 mime_type: "image/x-jpg" }
  mail
end
different_layout(layout_name = "") click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 116
def different_layout(layout_name = "")
  mail do |format|
    format.text { render layout: layout_name }
    format.html { render layout: layout_name }
  end
end
email_with_translations() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 123
def email_with_translations
  mail body: render("email_with_translations", formats: [:html])
end
explicit_different_template(template_name = "") click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 109
def explicit_different_template(template_name = "")
  mail do |format|
    format.text { render template: "#{mailer_name}/#{template_name}" }
    format.html { render template: "#{mailer_name}/#{template_name}" }
  end
end
explicit_multipart(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 64
def explicit_multipart(hash = {})
  attachments["invoice.pdf"] = "This is test File content" if hash.delete(:attachments)
  mail(hash) do |format|
    format.text { render plain: "TEXT Explicit Multipart" }
    format.html { render plain: "HTML Explicit Multipart" }
  end
end
explicit_multipart_templates(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 72
def explicit_multipart_templates(hash = {})
  mail(hash) do |format|
    format.html
    format.text
  end
end
explicit_multipart_with_any(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 79
def explicit_multipart_with_any(hash = {})
  mail(hash) do |format|
    format.any(:text, :html) { render plain: "Format with any!" }
  end
end
explicit_multipart_with_one_template(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 98
def explicit_multipart_with_one_template(hash = {})
  mail(hash) do |format|
    format.html
    format.text
  end
end
explicit_multipart_with_options(include_html = false) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 91
def explicit_multipart_with_options(include_html = false)
  mail do |format|
    format.text(content_transfer_encoding: "base64") { render "welcome" }
    format.html { render "welcome" } if include_html
  end
end
explicit_without_specifying_format_with_any(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 85
def explicit_without_specifying_format_with_any(hash = {})
  mail(hash) do |format|
    format.any
  end
end
html_only(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 24
def html_only(hash = {})
  mail(hash)
end
implicit_different_template(template_name = "") click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 105
def implicit_different_template(template_name = "")
  mail(template_name: template_name)
end
implicit_multipart(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 55
def implicit_multipart(hash = {})
  attachments["invoice.pdf"] = "This is test File content" if hash.delete(:attachments)
  mail(hash)
end
implicit_with_locale(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 60
def implicit_with_locale(hash = {})
  mail(hash)
end
inline_attachment() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 32
def inline_attachment
  attachments.inline["logo.png"] = "\312\213\254\232"
  mail
end
plain_text_only(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 28
def plain_text_only(hash = {})
  mail(hash)
end
welcome(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 10
def welcome(hash = {})
  headers["X-SPAM"] = "Not SPAM"
  mail({ subject: "The first email on new API!" }.merge!(hash))
end
welcome_from_another_path(path) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 20
def welcome_from_another_path(path)
  mail(template_name: "welcome", template_path: path)
end
welcome_with_headers(hash = {}) click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 15
def welcome_with_headers(hash = {})
  headers hash
  mail
end
with_nil_as_return_value() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 130
def with_nil_as_return_value
  mail(template_name: "welcome")
  nil
end
with_subject_interpolations() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 135
def with_subject_interpolations
  mail(subject: default_i18n_subject(rapper_or_impersonator: "Slim Shady"), body: "")
end
without_mail_call() click to toggle source
# File actionmailer/test/mailers/base_mailer.rb, line 127
def without_mail_call
end