class Mailable implements Mailable

Properties

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.

protected string $markdown

The Markdown template for the message (if applicable).

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

The callbacks for the message.

Methods

void
send(Mailer $mailer)

Send the message using the given mailer.

mixed
queue(Factory $queue)

Queue the message for sending.

mixed
later(DateTime|int $delay, Factory $queue)

Deliver the queued message after the given delay.

array|string
buildView()

Build the view for the message.

array
buildMarkdownView()

Build the Markdown view for the message.

array
buildViewData()

Build the view data for the message.

string
buildMarkdownText(Markdown $markdown, array $data)

Build the text view for a Markdown message.

$this
buildFrom(Message $message)

Add the sender to the message.

$this
buildRecipients(Message $message)

Add all of the recipients to the message.

$this
buildSubject(Message $message)

Set the subject for the message.

$this
buildAttachments(Message $message)

Add all of the attachments to the message.

$this
runCallbacks(Message $message)

Run the callbacks for the message.

$this
priority(int $level = 3)

Set the priority of this message.

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

Set the sender of the message.

bool
hasFrom(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

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

Set the recipients of the message.

bool
hasTo(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

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

$this
setAddress(object|array|string $address, string|null $name = null, string $property = 'to')

Set the recipients of the message.

array
addressesToArray(object|array|string $address, string|null $name)

Convert the given recipient arguments to an array.

object
normalizeRecipient(mixed $recipient)

Convert the given recipient into an object.

bool
hasRecipient(object|array|string $address, string|null $name = null, string $property = 'to')

Determine if the given recipient is set on the mailable.

$this
subject(string $subject)

Set the subject of the message.

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

Set the Markdown template for the message.

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

Set the view and view data for the message.

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

Set the plain text view for the message.

$this
with(string|array $key, mixed $value = null)

Set the view data for the message.

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

Attach a file to the message.

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

Attach in-memory data as an attachment.

$this
withSwiftMessage(callable $callback)

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

$this
__call(string $method, array $parameters)

Dynamically bind parameters to the message.

Details

at line 114
void send(Mailer $mailer)

Send the message using the given mailer.

Parameters

Mailer $mailer

Return Value

void

at line 133
mixed queue(Factory $queue)

Queue the message for sending.

Parameters

Factory $queue

Return Value

mixed

at line 155
mixed later(DateTime|int $delay, Factory $queue)

Deliver the queued message after the given delay.

Parameters

DateTime|int $delay
Factory $queue

Return Value

mixed

at line 171
protected array|string buildView()

Build the view for the message.

Return Value

array|string

at line 191
protected array buildMarkdownView()

Build the Markdown view for the message.

Return Value

array

at line 208
array buildViewData()

Build the view data for the message.

Return Value

array

at line 228
protected string buildMarkdownText(Markdown $markdown, array $data)

Build the text view for a Markdown message.

Parameters

Markdown $markdown
array $data

Return Value

string

at line 241
protected $this buildFrom(Message $message)

Add the sender to the message.

Parameters

Message $message

Return Value

$this

at line 256
protected $this buildRecipients(Message $message)

Add all of the recipients to the message.

Parameters

Message $message

Return Value

$this

at line 273
protected $this buildSubject(Message $message)

Set the subject for the message.

Parameters

Message $message

Return Value

$this

at line 290
protected $this buildAttachments(Message $message)

Add all of the attachments to the message.

Parameters

Message $message

Return Value

$this

at line 311
protected $this runCallbacks(Message $message)

Run the callbacks for the message.

Parameters

Message $message

Return Value

$this

at line 328
$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.

Parameters

int $level

Return Value

$this

at line 344
$this from(object|array|string $address, string|null $name = null)

Set the sender of the message.

Parameters

object|array|string $address
string|null $name

Return Value

$this

at line 356
bool hasFrom(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

Parameters

object|array|string $address
string|null $name

Return Value

bool

at line 368
$this to(object|array|string $address, string|null $name = null)

Set the recipients of the message.

Parameters

object|array|string $address
string|null $name

Return Value

$this

at line 380
bool hasTo(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

Parameters

object|array|string $address
string|null $name

Return Value

bool

at line 392
$this cc(object|array|string $address, string|null $name = null)

Set the recipients of the message.

Parameters

object|array|string $address
string|null $name

Return Value

$this

at line 404
bool hasCc(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

Parameters

object|array|string $address
string|null $name

Return Value

bool

at line 416
$this bcc(object|array|string $address, string|null $name = null)

Set the recipients of the message.

Parameters

object|array|string $address
string|null $name

Return Value

$this

at line 428
bool hasBcc(object|array|string $address, string|null $name = null)

Determine if the given recipient is set on the mailable.

Parameters

object|array|string $address
string|null $name

Return Value

bool

at line 440
$this replyTo(object|array|string $address, string|null $name = null)

Set the "reply to" address of the message.

Parameters

object|array|string $address
string|null $name

Return Value

$this

at line 455
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' => ?]]

Parameters

object|array|string $address
string|null $name
string $property

Return Value

$this

at line 476
protected array addressesToArray(object|array|string $address, string|null $name)

Convert the given recipient arguments to an array.

Parameters

object|array|string $address
string|null $name

Return Value

array

at line 491
protected object normalizeRecipient(mixed $recipient)

Convert the given recipient into an object.

Parameters

mixed $recipient

Return Value

object

at line 510
protected bool hasRecipient(object|array|string $address, string|null $name = null, string $property = 'to')

Determine if the given recipient is set on the mailable.

Parameters

object|array|string $address
string|null $name
string $property

Return Value

bool

at line 536
$this subject(string $subject)

Set the subject of the message.

Parameters

string $subject

Return Value

$this

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

Set the Markdown template for the message.

Parameters

string $view
array $data

Return Value

$this

at line 565
$this view(string $view, array $data = [])

Set the view and view data for the message.

Parameters

string $view
array $data

Return Value

$this

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

Set the plain text view for the message.

Parameters

string $textView
array $data

Return Value

$this

at line 595
$this with(string|array $key, mixed $value = null)

Set the view data for the message.

Parameters

string|array $key
mixed $value

Return Value

$this

at line 613
$this attach(string $file, array $options = [])

Attach a file to the message.

Parameters

string $file
array $options

Return Value

$this

at line 628
$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

at line 641
$this withSwiftMessage(callable $callback)

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

Parameters

callable $callback

Return Value

$this

at line 657
$this __call(string $method, array $parameters)

Dynamically bind parameters to the message.

Parameters

string $method
array $parameters

Return Value

$this

Exceptions

BadMethodCallException