Flowdock
method

create_inbound_email_from_mail

Importance_2
v6.1.3.1 - Show latest stable - 0 notes - Class: TestHelper
  • 1.0.0
  • 1.1.6
  • 1.2.6
  • 2.0.3
  • 2.1.0
  • 2.2.1
  • 2.3.2
  • 2.3.8
  • 3.0.0
  • 3.0.9
  • 3.1.0
  • 3.2.1
  • 3.2.8
  • 3.2.13
  • 4.0.2
  • 4.1.8
  • 4.2.1
  • 4.2.7
  • 4.2.9
  • 5.0.0.1
  • 5.1.7
  • 5.2.3
  • 6.0.0 (0)
  • 6.1.3.1 (38)
  • What's this?
create_inbound_email_from_mail(status: :processing, **mail_options, &block) public

Creates an InboundEmail by specifying through options or a block.

Options

Creating a simple email

When you only need to set basic fields like from, to, subject, and body, you can pass them directly as options.

create_inbound_email_from_mail(from: "david@loudthinking.com", subject: "Hello!")

Creating a multi-part email

When you need to create a more intricate email, like a multi-part email that contains both a plaintext version and an HTML version, you can pass a block.

create_inbound_email_from_mail do
  to "David Heinemeier Hansson <david@loudthinking.com>"
  from "Bilbo Baggins <bilbo@bagend.com>"
  subject "Come down to the Shire!"

  text_part do
    body "Please join us for a party at Bag End"
  end

  html_part do
    body "<h1>Please join us for a party at Bag End</h1>"
  end
end

As with Mail.new, you can also use a block parameter to define the parts of the message:

create_inbound_email_from_mail do |mail|
  mail.to "David Heinemeier Hansson <david@loudthinking.com>"
  mail.from "Bilbo Baggins <bilbo@bagend.com>"
  mail.subject "Come down to the Shire!"

  mail.text_part do |part|
    part.body "Please join us for a party at Bag End"
  end

  mail.html_part do |part|
    part.body "<h1>Please join us for a party at Bag End</h1>"
  end
end
Show source
Register or log in to add new notes.