Mailable
class Mailable implements Mailable, Renderable (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
string | $locale | The locale of the message. |
|
array | $from | The person the message is from. |
|
array | $to | The "to" recipients of the message. |
|
array | $cc | The "cc" recipients of the message. |
|
array | $bcc | The "bcc" recipients of the message. |
|
array | $replyTo | The "reply to" recipients of the message. |
|
string | $subject | The subject of the message. |
|
string | $markdown | The Markdown template for the message (if applicable). |
|
protected string | $html | The HTML to use for the message. |
|
string | $view | The view to use for the message. |
|
string | $textView | The plain text view to use for the message. |
|
array | $viewData | The view data for the message. |
|
array | $attachments | The attachments for the message. |
|
array | $rawAttachments | The raw attachments for the message. |
|
array | $diskAttachments | The attachments from a storage disk. |
|
protected array | $tags | The tags for the message. |
|
protected array | $metadata | The metadata for the message. |
|
array | $callbacks | The callbacks for the message. |
|
string|null | $theme | The name of the theme that should be used when formatting the message. |
|
string | $mailer | The name of the mailer that should send the message. |
|
protected array | $assertionableRenderStrings | The rendered mailable views for testing / assertions. |
|
static callable | $viewDataCallback | The callback that should be invoked while building the view data. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Call the given Closure with this instance then return the instance.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically bind parameters to the message.
Deliver the queued message after (n) seconds.
Make the queued mailable job instance.
Render the mailable into a view.
Build the view for the message.
Build the Markdown view for the message.
Build the view data for the message.
Get additional meta-data to pass along with the view data.
Build the HTML view for a Markdown message.
Build the text view for a Markdown message.
Resolves a Markdown instance with the mail's theme.
Set the locale of the message.
Set the priority of this message.
Set the sender of the message.
Determine if the given recipient is set on the mailable.
Set the recipients of the message.
Determine if the given recipient is set on the mailable.
Set the recipients of the message.
Determine if the given recipient is set on the mailable.
Set the recipients of the message.
Determine if the given recipient is set on the mailable.
Set the "reply to" address of the message.
Determine if the given replyTo is set on the mailable.
Set the recipients of the message.
Convert the given recipient arguments to an array.
Convert the given recipient into an object.
Determine if the given recipient is set on the mailable.
Set the subject of the message.
Determine if the mailable has the given subject.
Set the Markdown template for the message.
Set the view and view data for the message.
Set the rendered HTML content for the message.
Set the plain text view for the message.
Set the view data for the message.
Attach multiple files to the message.
Determine if the mailable has the given attachment.
Attach a file to the message from storage.
Attach a file to the message from storage.
Determine if the mailable has the given attachment from storage.
Determine if the mailable has the given attachment from a specific storage disk.
Attach in-memory data as an attachment.
Determine if the mailable has the given data as an attachment.
Add a tag header to the message when supported by the underlying transport.
Determine if the mailable has the given tag.
Add a metadata header to the message when supported by the underlying transport.
Determine if the mailable has the given metadata.
Assert that the mailable is from the given address.
Assert that the mailable has the given recipient.
Assert that the mailable has the given recipient.
Assert that the mailable has the given recipient.
Assert that the mailable has the given recipient.
Assert that the mailable has the given "reply to" address.
Assert that the mailable has the given subject.
Assert that the given text is present in the HTML email body.
Assert that the given text is not present in the HTML email body.
Assert that the given text strings are present in order in the HTML email body.
Assert that the given text is present in the plain-text email body.
Assert that the given text is not present in the plain-text email body.
Assert that the given text strings are present in order in the plain-text email body.
Assert the mailable has the given attachment.
Assert the mailable has the given data as an attachment.
Assert the mailable has the given attachment from storage.
Assert the mailable has the given attachment from a specific storage disk.
Assert that the mailable has the given tag.
Assert that the mailable has the given metadata.
Render the HTML and plain-text version of the mailable into views for assertions.
Prepare the mailable instance for delivery.
Set the name of the mailer that should send the message.
Register a callback to be called with the Symfony message instance.
Register a callback to be called while building the view data.
Details
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
mixed
later(DateTimeInterface|DateInterval|int $delay, Factory $queue)
Deliver the queued message after (n) seconds.
protected void
buildDiskAttachments(Message $message)
Add all of the disk attachments to the message.
$this
priority(int $level = 3)
Set the priority of this message.
The value is an integer where 1 is the highest priority and 5 is the lowest.
bool
hasFrom(object|array|string $address, string|null $name = null)
Determine if the given recipient is set on the mailable.
bool
hasTo(object|array|string $address, string|null $name = null)
Determine if the given recipient is set on the mailable.
Mailable
cc(object|array|string $address, string|null $name = null)
Set the recipients of the message.
bool
hasCc(object|array|string $address, string|null $name = null)
Determine if the given recipient is set on the mailable.
$this
bcc(object|array|string $address, string|null $name = null)
Set the recipients of the message.
bool
hasBcc(object|array|string $address, string|null $name = null)
Determine if the given recipient is set on the mailable.
$this
replyTo(object|array|string $address, string|null $name = null)
Set the "reply to" address of the message.
bool
hasReplyTo(object|array|string $address, string|null $name = null)
Determine if the given replyTo is set on the mailable.
protected $this
setAddress(object|array|string $address, string|null $name = null, string $property = 'to')
Set the recipients of the message.
All recipients are stored internally as [['name' => ?, 'address' => ?]]
protected array
addressesToArray(object|array|string $address, string|null $name)
Convert the given recipient arguments to an array.
protected bool
hasRecipient(object|array|string $address, string|null $name = null, string $property = 'to')
Determine if the given recipient is set on the mailable.
bool
hasAttachment(string|Attachable|Attachment $file, array $options = [])
Determine if the mailable has the given attachment.
$this
attachFromStorage(string $path, string|null $name = null, array $options = [])
Attach a file to the message from storage.
$this
attachFromStorageDisk(string $disk, string $path, string|null $name = null, array $options = [])
Attach a file to the message from storage.
bool
hasAttachmentFromStorage(string $path, string|null $name = null, array $options = [])
Determine if the mailable has the given attachment from storage.
bool
hasAttachmentFromStorageDisk(string $disk, string $path, string|null $name = null, array $options = [])
Determine if the mailable has the given attachment from a specific storage disk.
$this
attachData(string $data, string $name, array $options = [])
Attach in-memory data as an attachment.
bool
hasAttachedData(string $data, string $name, array $options = [])
Determine if the mailable has the given data as an attachment.
$this
tag(string $value)
Add a tag header to the message when supported by the underlying transport.
$this
metadata(string $key, string $value)
Add a metadata header to the message when supported by the underlying transport.
$this
assertFrom(object|array|string $address, string|null $name = null)
Assert that the mailable is from the given address.
$this
assertTo(object|array|string $address, string|null $name = null)
Assert that the mailable has the given recipient.
$this
assertHasTo(object|array|string $address, string|null $name = null)
Assert that the mailable has the given recipient.
$this
assertHasCc(object|array|string $address, string|null $name = null)
Assert that the mailable has the given recipient.
$this
assertHasBcc(object|array|string $address, string|null $name = null)
Assert that the mailable has the given recipient.
$this
assertHasReplyTo(object|array|string $address, string|null $name = null)
Assert that the mailable has the given "reply to" address.
$this
assertSeeInHtml(string $string, bool $escape = true)
Assert that the given text is present in the HTML email body.
$this
assertDontSeeInHtml(string $string, bool $escape = true)
Assert that the given text is not present in the HTML email body.
$this
assertSeeInOrderInHtml(array $strings, bool $escape = true)
Assert that the given text strings are present in order in the HTML email body.
$this
assertSeeInText(string $string)
Assert that the given text is present in the plain-text email body.
$this
assertDontSeeInText(string $string)
Assert that the given text is not present in the plain-text email body.
$this
assertSeeInOrderInText(array $strings)
Assert that the given text strings are present in order in the plain-text email body.
$this
assertHasAttachment(string|Attachable|Attachment $file, array $options = [])
Assert the mailable has the given attachment.
$this
assertHasAttachedData(string $data, string $name, array $options = [])
Assert the mailable has the given data as an attachment.
$this
assertHasAttachmentFromStorage(string $path, string|null $name = null, array $options = [])
Assert the mailable has the given attachment from storage.
$this
assertHasAttachmentFromStorageDisk(string $disk, string $path, string|null $name = null, array $options = [])
Assert the mailable has the given attachment from a specific storage disk.
$this
assertHasMetadata(string $key, string $value)
Assert that the mailable has the given metadata.
protected array
renderForAssertions()
Render the HTML and plain-text version of the mailable into views for assertions.
$this
withSymfonyMessage(callable $callback)
Register a callback to be called with the Symfony message instance.