Mailable
extends Mailable
in package
Uses
Queueable, SerializesModels
Generic mailable class.
Tags
Table of Contents
- $attachments : array<string|int, mixed>
- The attachments for the message.
- $bcc : array<string|int, mixed>
- The "bcc" recipients of the message.
- $callbacks : array<string|int, mixed>
- The callbacks for the message.
- $cc : array<string|int, mixed>
- The "cc" recipients of the message.
- $chainConnection : string|null
- The name of the connection the chain should be sent to.
- $chained : array<string|int, mixed>
- The jobs that should run if this job is successful.
- $chainQueue : string|null
- The name of the queue the chain should be sent to.
- $connection : string|null
- The name of the connection the job should be sent to.
- $delay : DateTimeInterface|DateInterval|int|null
- The number of seconds before the job should be made available.
- $from : array<string|int, mixed>
- The person the message is from.
- $queue : string|null
- The name of the queue the job should be sent to.
- $rawAttachments : array<string|int, mixed>
- The raw attachments for the message.
- $replyTo : array<string|int, mixed>
- The "reply to" recipients of the message.
- $subject : string
- The subject of the message.
- $textView : string
- The plain text view to use for the message.
- $to : array<string|int, mixed>
- The "to" recipients of the message.
- $view : string
- The view to use for the message.
- $viewData : array<string|int, mixed>
- The view data for the message.
- $markdown : string
- The Markdown template for the message (if applicable).
- __call() : $this
- Dynamically bind parameters to the message.
- __sleep() : array<string|int, mixed>
- Prepare the instance for serialization.
- __wakeup() : void
- Restore the model after serialization.
- allOnConnection() : $this
- Set the desired connection for the chain.
- allOnQueue() : $this
- Set the desired queue for the chain.
- attach() : $this
- Attach a file to the message.
- attachData() : $this
- Attach in-memory data as an attachment.
- bcc() : $this
- Set the recipients of the message.
- build() : $this
- Build the message.
- buildViewData() : array<string|int, mixed>
- Build the view data for the message.
- cc() : $this
- Set the recipients of the message.
- chain() : $this
- Set the jobs that should run if this job is successful.
- delay() : $this
- Set the desired delay for the job.
- dispatchNextJobInChain() : void
- Dispatch the next job on the chain.
- from() : $this
- Set the sender of the message.
- hasBcc() : bool
- Determine if the given recipient is set on the mailable.
- hasCc() : bool
- Determine if the given recipient is set on the mailable.
- hasFrom() : bool
- Determine if the given recipient is set on the mailable.
- hasReplyTo() : bool
- Determine if the given recipient is set on the mailable.
- hasTo() : bool
- Determine if the given recipient is set on the mailable.
- later() : mixed
- Deliver the queued message after the given delay.
- markdown() : $this
- Set the Markdown template for the message.
- onConnection() : $this
- Set the desired connection for the job.
- onQueue() : $this
- Set the desired queue for the job.
- priority() : $this
- Set the priority of this message.
- queue() : mixed
- Queue the message for sending.
- render() : string
- Render the mailable into a view.
- replyTo() : $this
- Set the "reply to" address of the message.
- send() : void
- Send the message using the given mailer.
- subject() : $this
- Set the subject of the message.
- text() : $this
- Set the plain text view for the message.
- to() : $this
- Set the recipients of the message.
- view() : $this
- Set the view and view data for the message.
- with() : $this
- Set the view data for the message.
- withSerializedData() : $this
- Set serialized view data for the message.
- withSwiftMessage() : $this
- Register a callback to be called with the Swift message instance.
- addressesToArray() : array<string|int, mixed>
- Convert the given recipient arguments to an array.
- buildAttachments() : $this
- Add all of the attachments to the message.
- buildFrom() : $this
- Add the sender to the message.
- buildMarkdownText() : string
- Build the text view for a Markdown message.
- buildMarkdownView() : array<string|int, mixed>
- Build the Markdown view for the message.
- buildRecipients() : $this
- Add all of the recipients to the message.
- buildSubject() : $this
- Set the subject for the message.
- buildView() : array<string|int, mixed>|string
- Build the view for the message.
- getPropertyValue() : mixed
- Get the property value for the given property.
- hasRecipient() : bool
- Determine if the given recipient is set on the mailable.
- normalizeRecipient() : object
- Convert the given recipient into an object.
- runCallbacks() : $this
- Run the callbacks for the message.
- setAddress() : $this
- Set the recipients of the message.
Properties
$attachments
The attachments for the message.
public
array<string|int, mixed>
$attachments
= []
$bcc
The "bcc" recipients of the message.
public
array<string|int, mixed>
$bcc
= []
$callbacks
The callbacks for the message.
public
array<string|int, mixed>
$callbacks
= []
$cc
The "cc" recipients of the message.
public
array<string|int, mixed>
$cc
= []
$chainConnection
The name of the connection the chain should be sent to.
public
string|null
$chainConnection
$chained
The jobs that should run if this job is successful.
public
array<string|int, mixed>
$chained
= []
$chainQueue
The name of the queue the chain should be sent to.
public
string|null
$chainQueue
$connection
The name of the connection the job should be sent to.
public
string|null
$connection
$delay
The number of seconds before the job should be made available.
public
DateTimeInterface|DateInterval|int|null
$delay
$from
The person the message is from.
public
array<string|int, mixed>
$from
= []
$queue
The name of the queue the job should be sent to.
public
string|null
$queue
$rawAttachments
The raw attachments for the message.
public
array<string|int, mixed>
$rawAttachments
= []
$replyTo
The "reply to" recipients of the message.
public
array<string|int, mixed>
$replyTo
= []
$subject
The subject of the message.
public
string
$subject
$textView
The plain text view to use for the message.
public
string
$textView
$to
The "to" recipients of the message.
public
array<string|int, mixed>
$to
= []
$view
The view to use for the message.
public
string
$view
$viewData
The view data for the message.
public
array<string|int, mixed>
$viewData
= []
$markdown
The Markdown template for the message (if applicable).
protected
string
$markdown
Methods
__call()
Dynamically bind parameters to the message.
public
__call(string $method, array<string|int, mixed> $parameters) : $this
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
$this —__sleep()
Prepare the instance for serialization.
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed> —__wakeup()
Restore the model after serialization.
public
__wakeup() : void
Return values
void —allOnConnection()
Set the desired connection for the chain.
public
allOnConnection(string|null $connection) : $this
Parameters
- $connection : string|null
Return values
$this —allOnQueue()
Set the desired queue for the chain.
public
allOnQueue(string|null $queue) : $this
Parameters
- $queue : string|null
Return values
$this —attach()
Attach a file to the message.
public
attach(string $file[, array<string|int, mixed> $options = [] ]) : $this
Parameters
- $file : string
- $options : array<string|int, mixed> = []
Return values
$this —attachData()
Attach in-memory data as an attachment.
public
attachData(string $data, string $name[, array<string|int, mixed> $options = [] ]) : $this
Parameters
- $data : string
- $name : string
- $options : array<string|int, mixed> = []
Return values
$this —bcc()
Set the recipients of the message.
public
bcc(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : $this
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
$this —build()
Build the message.
public
build() : $this
Return values
$this —buildViewData()
Build the view data for the message.
public
buildViewData() : array<string|int, mixed>
Return values
array<string|int, mixed> —cc()
Set the recipients of the message.
public
cc(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : $this
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
$this —chain()
Set the jobs that should run if this job is successful.
public
chain(array<string|int, mixed> $chain) : $this
Parameters
- $chain : array<string|int, mixed>
Return values
$this —delay()
Set the desired delay for the job.
public
delay(DateTimeInterface|DateInterval|int|null $delay) : $this
Parameters
- $delay : DateTimeInterface|DateInterval|int|null
Return values
$this —dispatchNextJobInChain()
Dispatch the next job on the chain.
public
dispatchNextJobInChain() : void
Return values
void —from()
Set the sender of the message.
public
from(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : $this
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
$this —hasBcc()
Determine if the given recipient is set on the mailable.
public
hasBcc(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
bool —hasCc()
Determine if the given recipient is set on the mailable.
public
hasCc(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
bool —hasFrom()
Determine if the given recipient is set on the mailable.
public
hasFrom(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
bool —hasReplyTo()
Determine if the given recipient is set on the mailable.
public
hasReplyTo(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
bool —hasTo()
Determine if the given recipient is set on the mailable.
public
hasTo(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
bool —later()
Deliver the queued message after the given delay.
public
later(DateTimeInterface|DateInterval|int $delay, Factory $queue) : mixed
Parameters
- $delay : DateTimeInterface|DateInterval|int
- $queue : Factory
Return values
mixed —markdown()
Set the Markdown template for the message.
public
markdown(string $view[, array<string|int, mixed> $data = [] ]) : $this
Parameters
- $view : string
- $data : array<string|int, mixed> = []
Return values
$this —onConnection()
Set the desired connection for the job.
public
onConnection(string|null $connection) : $this
Parameters
- $connection : string|null
Return values
$this —onQueue()
Set the desired queue for the job.
public
onQueue(string|null $queue) : $this
Parameters
- $queue : string|null
Return values
$this —priority()
Set the priority of this message.
public
priority([int $level = 3 ]) : $this
The value is an integer where 1 is the highest priority and 5 is the lowest.
Parameters
- $level : int = 3
Return values
$this —queue()
Queue the message for sending.
public
queue(Factory $queue) : mixed
Parameters
- $queue : Factory
Return values
mixed —render()
Render the mailable into a view.
public
render() : string
Return values
string —replyTo()
Set the "reply to" address of the message.
public
replyTo(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : $this
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
$this —send()
Send the message using the given mailer.
public
send(Mailer $mailer) : void
Parameters
- $mailer : Mailer
Return values
void —subject()
Set the subject of the message.
public
subject(string $subject) : $this
Parameters
- $subject : string
Return values
$this —text()
Set the plain text view for the message.
public
text(string $textView[, array<string|int, mixed> $data = [] ]) : $this
Parameters
- $textView : string
- $data : array<string|int, mixed> = []
Return values
$this —to()
Set the recipients of the message.
public
to(object|array<string|int, mixed>|string $address[, string|null $name = null ]) : $this
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
Return values
$this —view()
Set the view and view data for the message.
public
view(string $view[, array<string|int, mixed> $data = [] ]) : $this
Parameters
- $view : string
- $data : array<string|int, mixed> = []
Return values
$this —with()
Set the view data for the message.
public
with(string|array<string|int, mixed> $key[, mixed $value = null ]) : $this
Parameters
- $key : string|array<string|int, mixed>
- $value : mixed = null
Return values
$this —withSerializedData()
Set serialized view data for the message.
public
withSerializedData(array<string|int, mixed> $data) : $this
Parameters
- $data : array<string|int, mixed>
Return values
$this —withSwiftMessage()
Register a callback to be called with the Swift message instance.
public
withSwiftMessage(callable $callback) : $this
Parameters
- $callback : callable
Return values
$this —addressesToArray()
Convert the given recipient arguments to an array.
protected
addressesToArray(object|array<string|int, mixed>|string $address, string|null $name) : array<string|int, mixed>
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null
Return values
array<string|int, mixed> —buildAttachments()
Add all of the attachments to the message.
protected
buildAttachments(Message $message) : $this
Parameters
- $message : Message
Return values
$this —buildFrom()
Add the sender to the message.
protected
buildFrom(Message $message) : $this
Parameters
- $message : Message
Return values
$this —buildMarkdownText()
Build the text view for a Markdown message.
protected
buildMarkdownText(Markdown $markdown, array<string|int, mixed> $data) : string
Parameters
- $markdown : Markdown
- $data : array<string|int, mixed>
Return values
string —buildMarkdownView()
Build the Markdown view for the message.
protected
buildMarkdownView() : array<string|int, mixed>
Return values
array<string|int, mixed> —buildRecipients()
Add all of the recipients to the message.
protected
buildRecipients(Message $message) : $this
Parameters
- $message : Message
Return values
$this —buildSubject()
Set the subject for the message.
protected
buildSubject(Message $message) : $this
Parameters
- $message : Message
Return values
$this —buildView()
Build the view for the message.
protected
buildView() : array<string|int, mixed>|string
Return values
array<string|int, mixed>|string —getPropertyValue()
Get the property value for the given property.
protected
getPropertyValue(ReflectionProperty $property) : mixed
Parameters
- $property : ReflectionProperty
Return values
mixed —hasRecipient()
Determine if the given recipient is set on the mailable.
protected
hasRecipient(object|array<string|int, mixed>|string $address[, string|null $name = null ][, string $property = 'to' ]) : bool
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
- $property : string = 'to'
Return values
bool —normalizeRecipient()
Convert the given recipient into an object.
protected
normalizeRecipient(mixed $recipient) : object
Parameters
- $recipient : mixed
Return values
object —runCallbacks()
Run the callbacks for the message.
protected
runCallbacks(Message $message) : $this
Parameters
- $message : Message
Return values
$this —setAddress()
Set the recipients of the message.
protected
setAddress(object|array<string|int, mixed>|string $address[, string|null $name = null ][, string $property = 'to' ]) : $this
All recipients are stored internally as [['name' => ?, 'address' => ?]]
Parameters
- $address : object|array<string|int, mixed>|string
- $name : string|null = null
- $property : string = 'to'