class MailMessage extends SimpleMessage implements Renderable (View source)

Traits

Properties

string $level

The "level" of the notification (info, success, error).

from  SimpleMessage
string $subject

The subject of the notification.

from  SimpleMessage
string $greeting

The notification's greeting.

from  SimpleMessage
string $salutation

The notification's salutation.

from  SimpleMessage
array $introLines

The "intro" lines of the notification.

from  SimpleMessage
array $outroLines

The "outro" lines of the notification.

from  SimpleMessage
string $actionText

The text / label for the action.

from  SimpleMessage
string $actionUrl

The action URL.

from  SimpleMessage
string $mailer

The name of the mailer that should send the notification.

from  SimpleMessage
array|string $view

The view to be rendered.

array $viewData

The view data for the message.

string|null $markdown

The Markdown template to render (if applicable).

string|null $theme

The current theme being used when generating emails.

array $from

The "from" information for the message.

array $replyTo

The "reply to" information for the message.

array $cc

The "cc" information for the message.

array $bcc

The "bcc" information for the message.

array $attachments

The attachments for the message.

array $rawAttachments

The raw attachments for the message.

array $tags

The tags for the message.

array $metadata

The metadata for the message.

int $priority

Priority level of the message.

array $callbacks

The callbacks for the message.

Methods

$this
success()

Indicate that the notification gives information about a successful operation.

$this
error()

Indicate that the notification gives information about an error.

$this
level(string $level)

Set the "level" of the notification (success, error, etc.).

$this
subject(string $subject)

Set the subject of the notification.

$this
greeting(string $greeting)

Set the greeting of the notification.

$this
salutation(string $salutation)

Set the salutation of the notification.

$this
line(mixed $line)

Add a line of text to the notification.

$this
lineIf(bool $boolean, mixed $line)

Add a line of text to the notification if the given condition is true.

$this
lines(iterable $lines)

Add lines of text to the notification.

$this
linesIf(bool $boolean, iterable $lines)

Add lines of text to the notification if the given condition is true.

$this
with(mixed $line)

Add a line of text to the notification.

Htmlable|string
formatLine(Htmlable|string|array|null $line)

Format the given line of text.

$this
action(string $text, string $url)

Configure the "call to action" button.

$this
mailer(string $mailer)

Set the name of the mailer that should send the notification.

array
toArray()

Get an array representation of the message.

$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.

$this
view(array|string $view, array $data = [])

Set the view for the mail message.

$this
text(string $textView, array $data = [])

Set the plain text view for the mail message.

$this
markdown(string $view, array $data = [])

Set the Markdown template for the notification.

$this
template(string $template)

Set the default markdown template.

$this
theme(string $theme)

Set the theme to use with the Markdown template.

$this
from(string $address, string|null $name = null)

Set the from address for the mail message.

$this
replyTo(array|string $address, string|null $name = null)

Set the "reply to" address of the message.

$this
cc(array|string $address, string|null $name = null)

Set the cc address for the mail message.

$this
bcc(array|string $address, string|null $name = null)

Set the bcc address for the mail message.

$this
attach(string|Attachable|Attachment $file, array $options = [])

Attach a file to the message.

$this
attachMany((string|Attachable|Attachment|array)[] $files)

Attach multiple files to the message.

$this
attachData(string $data, string $name, array $options = [])

Attach in-memory 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
priority(int $level)

Set the priority of this message.

array
data()

Get the data array for the mail message.

array
parseAddresses(array $value)

Parse the multi-address array into the necessary format.

bool
arrayOfAddresses(mixed $address)

Determine if the given "address" is actually an array of addresses.

string
render()

Render the mail notification message into an HTML string.

$this
withSymfonyMessage(callable $callback)

Register a callback to be called with the Symfony message instance.

Details

$this success()

Indicate that the notification gives information about a successful operation.

Return Value

$this

$this error()

Indicate that the notification gives information about an error.

Return Value

$this

$this level(string $level)

Set the "level" of the notification (success, error, etc.).

Parameters

string $level

Return Value

$this

$this subject(string $subject)

Set the subject of the notification.

Parameters

string $subject

Return Value

$this

$this greeting(string $greeting)

Set the greeting of the notification.

Parameters

string $greeting

Return Value

$this

$this salutation(string $salutation)

Set the salutation of the notification.

Parameters

string $salutation

Return Value

$this

$this line(mixed $line)

Add a line of text to the notification.

Parameters

mixed $line

Return Value

$this

$this lineIf(bool $boolean, mixed $line)

Add a line of text to the notification if the given condition is true.

Parameters

bool $boolean
mixed $line

Return Value

$this

$this lines(iterable $lines)

Add lines of text to the notification.

Parameters

iterable $lines

Return Value

$this

$this linesIf(bool $boolean, iterable $lines)

Add lines of text to the notification if the given condition is true.

Parameters

bool $boolean
iterable $lines

Return Value

$this

$this with(mixed $line)

Add a line of text to the notification.

Parameters

mixed $line

Return Value

$this

protected Htmlable|string formatLine(Htmlable|string|array|null $line)

Format the given line of text.

Parameters

Htmlable|string|array|null $line

Return Value

Htmlable|string

$this action(string $text, string $url)

Configure the "call to action" button.

Parameters

string $text
string $url

Return Value

$this

$this mailer(string $mailer)

Set the name of the mailer that should send the notification.

Parameters

string $mailer

Return Value

$this

array toArray()

Get an array representation of the message.

Return Value

array

$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.

Parameters

$value
callable|null $callback
callable|null $default

Return Value

$this|TWhenReturnType

$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.

Parameters

$value
callable|null $callback
callable|null $default

Return Value

$this|TUnlessReturnType

$this view(array|string $view, array $data = [])

Set the view for the mail message.

Parameters

array|string $view
array $data

Return Value

$this

$this text(string $textView, array $data = [])

Set the plain text view for the mail message.

Parameters

string $textView
array $data

Return Value

$this

$this markdown(string $view, array $data = [])

Set the Markdown template for the notification.

Parameters

string $view
array $data

Return Value

$this

$this template(string $template)

Set the default markdown template.

Parameters

string $template

Return Value

$this

$this theme(string $theme)

Set the theme to use with the Markdown template.

Parameters

string $theme

Return Value

$this

$this from(string $address, string|null $name = null)

Set the from address for the mail message.

Parameters

string $address
string|null $name

Return Value

$this

$this replyTo(array|string $address, string|null $name = null)

Set the "reply to" address of the message.

Parameters

array|string $address
string|null $name

Return Value

$this

$this cc(array|string $address, string|null $name = null)

Set the cc address for the mail message.

Parameters

array|string $address
string|null $name

Return Value

$this

$this bcc(array|string $address, string|null $name = null)

Set the bcc address for the mail message.

Parameters

array|string $address
string|null $name

Return Value

$this

$this attach(string|Attachable|Attachment $file, array $options = [])

Attach a file to the message.

Parameters

string|Attachable|Attachment $file
array $options

Return Value

$this

$this attachMany((string|Attachable|Attachment|array)[] $files)

Attach multiple files to the message.

Parameters

(string|Attachable|Attachment|array)[] $files

Return Value

$this

$this attachData(string $data, string $name, array $options = [])

Attach in-memory data as an attachment.

Parameters

string $data
string $name
array $options

Return Value

$this

$this tag(string $value)

Add a tag header to the message when supported by the underlying transport.

Parameters

string $value

Return Value

$this

$this metadata(string $key, string $value)

Add a metadata header to the message when supported by the underlying transport.

Parameters

string $key
string $value

Return Value

$this

$this priority(int $level)

Set the priority of this message.

The value is an integer where 1 is the highest priority and 5 is the lowest.

Parameters

int $level

Return Value

$this

array data()

Get the data array for the mail message.

Return Value

array

protected array parseAddresses(array $value)

Parse the multi-address array into the necessary format.

Parameters

array $value

Return Value

array

protected bool arrayOfAddresses(mixed $address)

Determine if the given "address" is actually an array of addresses.

Parameters

mixed $address

Return Value

bool

string render()

Render the mail notification message into an HTML string.

Return Value

string

$this withSymfonyMessage(callable $callback)

Register a callback to be called with the Symfony message instance.

Parameters

callable $callback

Return Value

$this