Sha256: b0400ead1b119cc69369606c2b816da9eed73471473d97d165fb39b10db29d9a

Contents?: true

Size: 1.68 KB

Versions: 6

Compression:

Stored size: 1.68 KB

Contents

class TestMailer < ApplicationMailer
  default from: "default-sender@platan.us"

  def body_email
    set_content("Body")
    mail
  end

  def body_params_email
    mail(body: "<h1>Body Params</h1>", content_type: "text/html")
  end

  def rails_tpl_email
    mail
  end

  def from_email
    set_sender("override@platan.us")
    mail(body: "X")
  end

  def from_params_email
    mail(from: "override@platan.us", body: "X")
  end

  def recipients_email
    set_recipients(:to, "r1@platan.us", "r2@platan.us")
    set_recipients(:cc, ["r4@platan.us"])
    set_recipients(:bcc, "r5@platan.us")
    mail(body: "X")
  end

  def recipients_params_email
    mail(
      body: "X",
      to: ["r1@platan.us", "r2@platan.us"],
      cc: ["r4@platan.us"],
      bcc: "r5@platan.us"
    )
  end

  def template_id_email
    set_template_id("XXX")
    mail
  end

  def template_name_email
    set_template_name("my template name")
    mail(body: "X")
  end

  def template_id_params_email
    mail(template_id: "XXX")
  end

  def subject_email
    set_subject("My Subject")
    mail(body: "X")
  end

  def subject_params_email
    mail(subject: "My Subject", body: "X")
  end

  def headers_email
    headers["HEADER-1"] = "VALUE-1"
    headers["HEADER-2"] = "VALUE-2"
    mail(body: "X")
  end

  def headers_params_email
    mail(body: "X", headers: { "HEADER-1" => "VALUE-1", "HEADER-2" => "VALUE-2" })
  end

  def add_attachments_email
    image_path = File.expand_path("../../../spec/assets/image.png", __FILE__)
    attachments["nana.png"] = File.read(image_path)
    mail(body: "X")
  end

  def substitutions_email
    substitute "%key1%", "value1"
    substitute "%key2%", "value2"
    mail(body: "X")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
send_grid_mailer-0.5.0 spec/dummy/app/mailers/test_mailer.rb
send_grid_mailer-0.4.0 spec/dummy/app/mailers/test_mailer.rb
send_grid_mailer-0.3.0 spec/dummy/app/mailers/test_mailer.rb
send_grid_mailer-0.2.0 spec/dummy/app/mailers/test_mailer.rb
send_grid_mailer-0.1.1 spec/dummy/app/mailers/test_mailer.rb
send_grid_mailer-0.1.0 spec/dummy/app/mailers/test_mailer.rb