class MailMessage extends SimpleMessage implements Renderable

Traits

Properties

string $level

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

from  SimpleMessage
string|null $subject

The subject of the notification.

from  SimpleMessage
string|null $greeting

The notification's greeting.

from  SimpleMessage
string|null $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|null $actionText

The text / label for the action.

from  SimpleMessage
string|null $actionUrl

The action URL.

from  SimpleMessage
string|null $mailer

The name of the mailer that should send the notification.

from  SimpleMessage
array|string|null $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|null $priority

Priority level of the message.

array $callbacks

The callbacks for the message.

Methods

success()

Indicate that the notification gives information about a successful operation.

error()

Indicate that the notification gives information about an error.

level(string $level)

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

subject(string $subject)

Set the subject of the notification.

greeting(string $greeting)

Set the greeting of the notification.

salutation(string $salutation)

Set the salutation of the notification.

line(mixed $line)

Add a line of text to the notification.

lineIf(bool $boolean, mixed $line)

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

lines(iterable $lines)

Add lines of text to the notification.

linesIf(bool $boolean, iterable $lines)

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

with(mixed $line)

Add a line of text to the notification.

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

Format the given line of text.

action(string $text, string $url)

Configure the "call to action" button.

mailer(string $mailer)

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

array
toArray()

Get an array representation of the message.

mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

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

Set the view for the mail message.

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

Set the plain text view for the mail message.

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

Set the Markdown template for the notification.

template(string $template)

Set the default markdown template.

theme(string $theme)

Set the theme to use with the Markdown template.

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

Set the from address for the mail message.

replyTo(mixed $address, string|null $name = null)

Set the "reply to" address of the message.

cc(mixed $address, string|null $name = null)

Set the cc address for the mail message.

bcc(mixed $address, string|null $name = null)

Set the bcc address for the mail message.

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

Attach a file to the message.

attachMany(array $files)

Attach multiple files to the message.

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

Attach in-memory data as an attachment.

tag(string $value)

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

metadata(string $key, string $value)

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

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.

withSymfonyMessage(callable $callback)

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

Details

in SimpleMessage at line 60
SimpleMessage success()

Indicate that the notification gives information about a successful operation.

Return Value

SimpleMessage

in SimpleMessage at line 70
SimpleMessage error()

Indicate that the notification gives information about an error.

Return Value

SimpleMessage

in SimpleMessage at line 80
SimpleMessage level(string $level)

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

Parameters

string $level

Return Value

SimpleMessage

in SimpleMessage at line 90
SimpleMessage subject(string $subject)

Set the subject of the notification.

Parameters

string $subject

Return Value

SimpleMessage

in SimpleMessage at line 100
SimpleMessage greeting(string $greeting)

Set the greeting of the notification.

Parameters

string $greeting

Return Value

SimpleMessage

in SimpleMessage at line 110
SimpleMessage salutation(string $salutation)

Set the salutation of the notification.

Parameters

string $salutation

Return Value

SimpleMessage

in SimpleMessage at line 120
SimpleMessage line(mixed $line)

Add a line of text to the notification.

Parameters

mixed $line

Return Value

SimpleMessage

in SimpleMessage at line 128
SimpleMessage 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

SimpleMessage

in SimpleMessage at line 140
SimpleMessage lines(iterable $lines)

Add lines of text to the notification.

Parameters

iterable $lines

Return Value

SimpleMessage

in SimpleMessage at line 152
SimpleMessage 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

SimpleMessage

in SimpleMessage at line 164
SimpleMessage with(mixed $line)

Add a line of text to the notification.

Parameters

mixed $line

Return Value

SimpleMessage

in SimpleMessage at line 180
protected Htmlable|string formatLine(array|Htmlable|string|null $line)

Format the given line of text.

Parameters

array|Htmlable|string|null $line

Return Value

Htmlable|string

in SimpleMessage at line 196
SimpleMessage action(string $text, string $url)

Configure the "call to action" button.

Parameters

string $text
string $url

Return Value

SimpleMessage

in SimpleMessage at line 207
SimpleMessage mailer(string $mailer)

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

Parameters

string $mailer

Return Value

SimpleMessage

in SimpleMessage at line 217
array toArray()

Get an array representation of the message.

Return Value

array

in Conditionable at line 23
mixed when(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) truthy.

Parameters

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

Return Value

mixed

in Conditionable at line 56
mixed unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)

Apply the callback if the given "value" is (or resolves to) falsy.

Parameters

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

Return Value

mixed

at line 93
MailMessage view(array|string $view, array $data = [])

Set the view for the mail message.

Parameters

array|string $view
array $data

Return Value

MailMessage

at line 106
MailMessage text(string $textView, array $data = [])

Set the plain text view for the mail message.

Parameters

string $textView
array $data

Return Value

MailMessage

at line 117
MailMessage markdown(string $view, array $data = [])

Set the Markdown template for the notification.

Parameters

string $view
array $data

Return Value

MailMessage

at line 130
MailMessage template(string $template)

Set the default markdown template.

Parameters

string $template

Return Value

MailMessage

at line 140
MailMessage theme(string $theme)

Set the theme to use with the Markdown template.

Parameters

string $theme

Return Value

MailMessage

at line 150
MailMessage from(string $address, string|null $name = null)

Set the from address for the mail message.

Parameters

string $address
string|null $name

Return Value

MailMessage

at line 160
MailMessage replyTo(mixed $address, string|null $name = null)

Set the "reply to" address of the message.

Parameters

mixed $address
string|null $name

Return Value

MailMessage

at line 174
MailMessage cc(mixed $address, string|null $name = null)

Set the cc address for the mail message.

Parameters

mixed $address
string|null $name

Return Value

MailMessage

at line 188
MailMessage bcc(mixed $address, string|null $name = null)

Set the bcc address for the mail message.

Parameters

mixed $address
string|null $name

Return Value

MailMessage

at line 202
MailMessage attach(Attachable|Attachment|string $file, array $options = [])

Attach a file to the message.

Parameters

Attachable|Attachment|string $file
array $options

Return Value

MailMessage

at line 222
MailMessage attachMany(array $files)

Attach multiple files to the message.

Parameters

array $files

Return Value

MailMessage

at line 238
MailMessage attachData(string $data, string $name, array $options = [])

Attach in-memory data as an attachment.

Parameters

string $data
string $name
array $options

Return Value

MailMessage

at line 248
MailMessage tag(string $value)

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

Parameters

string $value

Return Value

MailMessage

at line 258
MailMessage 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

MailMessage

at line 270
MailMessage 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

MailMessage

at line 280
array data()

Get the data array for the mail message.

Return Value

array

at line 288
protected array parseAddresses(array $value)

Parse the multi-address array into the necessary format.

Parameters

array $value

Return Value

array

at line 298
protected bool arrayOfAddresses(mixed $address)

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

Parameters

mixed $address

Return Value

bool

at line 306
string render()

Render the mail notification message into an HTML string.

Return Value

string

at line 330
MailMessage withSymfonyMessage(callable $callback)

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

Parameters

callable $callback

Return Value

MailMessage