MailMessage
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<string, int|string> | $metadata | The metadata for the message. |
|
| int|null | $priority | Priority level of the message. |
|
| array | $callbacks | The callbacks for the message. |
Methods
Indicate that the notification gives information about a successful operation.
Indicate that the notification gives information about an error.
Set the "level" of the notification (success, error, etc.).
Set the salutation of the notification.
Add a line of text to the notification if the given condition is true.
Add lines of text to the notification if the given condition is true.
Configure the "call to action" button.
Set the name of the mailer that should send the notification.
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Set the view for the mail message.
Set the plain text view for the mail message.
Set the Markdown template for the notification.
Set the default markdown template.
Set the theme to use with the Markdown template.
Set the from address for the mail message.
Set the "reply to" address of the message.
Set the cc address for the mail message.
Set the bcc address for the mail message.
Attach multiple files to the message.
Attach in-memory data as an attachment.
Attach a file to the message from storage.
Attach a file to the message from storage.
Add a tag header to the message when supported by the underlying transport.
Add a metadata header to the message when supported by the underlying transport.
Set the priority of this message.
Get the data array for the mail message.
Determine if the given "address" is actually an array of addresses.
Render the mail notification message into an HTML string.
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.
in
SimpleMessage at line 70
SimpleMessage
error()
Indicate that the notification gives information about an error.
in
SimpleMessage at line 80
SimpleMessage
level(string $level)
Set the "level" of the notification (success, error, etc.).
in
SimpleMessage at line 90
SimpleMessage
subject(string $subject)
Set the subject of the notification.
in
SimpleMessage at line 100
SimpleMessage
greeting(string $greeting)
Set the greeting of the notification.
in
SimpleMessage at line 110
SimpleMessage
salutation(string $salutation)
Set the salutation of the notification.
in
SimpleMessage at line 120
SimpleMessage
line(mixed $line)
Add a line of text to the notification.
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.
in
SimpleMessage at line 140
SimpleMessage
lines(iterable $lines)
Add lines of text to the notification.
in
SimpleMessage at line 152
SimpleMessage
linesIf(bool $boolean, iterable $lines)
Add lines of text to the notification if the given condition is true.
in
SimpleMessage at line 164
SimpleMessage
with(mixed $line)
Add a line of text to the notification.
in
SimpleMessage at line 180
protected Htmlable|string
formatLine(array|Htmlable|string|null $line)
Format the given line of text.
in
SimpleMessage at line 196
SimpleMessage
action(string $text, string $url)
Configure the "call to action" button.
in
SimpleMessage at line 207
SimpleMessage
mailer(string $mailer)
Set the name of the mailer that should send the notification.
in
SimpleMessage at line 217
array
toArray()
Get an array representation of the message.
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.
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.
at line 95
MailMessage
view(array|string $view, array $data = [])
Set the view for the mail message.
at line 108
MailMessage
text(string $textView, array $data = [])
Set the plain text view for the mail message.
at line 119
MailMessage
markdown(string $view, array $data = [])
Set the Markdown template for the notification.
at line 132
MailMessage
template(string $template)
Set the default markdown template.
at line 142
MailMessage
theme(string $theme)
Set the theme to use with the Markdown template.
at line 152
MailMessage
from(string $address, string|null $name = null)
Set the from address for the mail message.
at line 162
MailMessage
replyTo(mixed $address, string|null $name = null)
Set the "reply to" address of the message.
at line 176
MailMessage
cc(mixed $address, string|null $name = null)
Set the cc address for the mail message.
at line 190
MailMessage
bcc(mixed $address, string|null $name = null)
Set the bcc address for the mail message.
at line 204
MailMessage
attach(Attachable|Attachment|string $file, array $options = [])
Attach a file to the message.
at line 224
MailMessage
attachMany(array $files)
Attach multiple files to the message.
at line 240
MailMessage
attachData(string $data, string $name, array $options = [])
Attach in-memory data as an attachment.
at line 250
MailMessage
attachFromStorage(string $path, string|null $name = null, array $options = [])
Attach a file to the message from storage.
at line 261
MailMessage
attachFromStorageDisk(string|null $disk, string $path, string|null $name = null, array $options = [])
Attach a file to the message from storage.
at line 283
MailMessage
tag(string $value)
Add a tag header to the message when supported by the underlying transport.
at line 293
MailMessage
metadata(string $key, int|string $value)
Add a metadata header to the message when supported by the underlying transport.
at line 305
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.
at line 315
array
data()
Get the data array for the mail message.
at line 323
protected array
parseAddresses(Arrayable|iterable $value)
Parse the multi-address array into the necessary format.
at line 334
protected bool
arrayOfAddresses(mixed $address)
Determine if the given "address" is actually an array of addresses.
at line 342
string
render()
Render the mail notification message into an HTML string.
at line 366
MailMessage
withSymfonyMessage(callable $callback)
Register a callback to be called with the Symfony message instance.