module ActionMailbox::TestHelper
def create_inbound_email_from_mail(status: :processing, **mail_options, &block)
end
part.body "
Please join us for a party at Bag End
"mail.html_part do |part|
end
part.body "Please join us for a party at Bag End"
mail.text_part do |part|
mail.subject "Come down to the Shire!"
mail.from "Bilbo Baggins
mail.to "David Heinemeier Hansson
create_inbound_email_from_mail do |mail|
of the message:
As with +Mail.new+, you can also use a block parameter to define the parts
end
end
body "
Please join us for a party at Bag End
"html_part do
end
body "Please join us for a party at Bag End"
text_part do
subject "Come down to the Shire!"
from "Bilbo Baggins
to "David Heinemeier Hansson
create_inbound_email_from_mail do
block.
that contains both a plaintext version and an HTML version, you can pass a
When you need to create a more intricate email, like a multi-part email
==== Creating a multi-part email
create_inbound_email_from_mail(from: "david@loudthinking.com", subject: "Hello!")
+body+, you can pass them directly as options.
When you only need to set basic fields like +from+, +to+, +subject+, and
==== Creating a simple email
For possible statuses, see {its documentation}[rdoc-ref:ActionMailbox::InboundEmail].
* :status - The +status+ to set for the created +InboundEmail+.
==== Options
Creates an +InboundEmail+ by specifying through options or a block.
def create_inbound_email_from_mail(status: :processing, **mail_options, &block) mail = Mail.new(mail_options, &block) # Bcc header is not encoded by default mail[:bcc].include_in_headers = true if mail[:bcc] create_inbound_email_from_source mail.to_s, status: status end