Mailer
extends Mailer
in package
Uses
Emitter
Mailer class for sending mail.
Tags
Table of Contents
- $emitterEventCollection : array<string|int, mixed>
- $emitterEventSorted : array<string|int, mixed>
- $emitterSingleEventCollection : array<string|int, mixed>
- $events : Dispatcher|null
- The event dispatcher instance.
- $failedRecipients : array<string|int, mixed>
- Array of failed recipients.
- $from : array<string|int, mixed>
- The global from address and name.
- $macros : array<string|int, mixed>
- The registered string macros.
- $pretendingOriginal : string
- $queue : Queue
- The queue implementation.
- $replyTo : array<string|int, mixed>
- The global reply-to address and name.
- $swift : Swift_Mailer
- The Swift Mailer instance.
- $to : array<string|int, mixed>
- The global to address and name.
- $views : Factory
- The view factory instance.
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- __construct() : void
- Create a new Mailer instance.
- alwaysFrom() : void
- Set the global from address and name.
- alwaysReplyTo() : void
- Set the global reply-to address and name.
- alwaysTo() : void
- Set the global to address and name.
- bcc() : PendingMail
- Begin the process of mailing a mailable class instance.
- bindEvent() : self
- Create a new event binding.
- bindEventOnce() : self
- Create a new event binding that fires once only
- failures() : array<string|int, mixed>
- Get the array of failed recipients.
- fireEvent() : array<string|int, mixed>
- Fire an event and call the listeners.
- getSwiftMailer() : Swift_Mailer
- Get the Swift Mailer instance.
- getViewFactory() : Factory
- Get the view factory instance.
- hasMacro() : bool
- Checks if macro is registered.
- later() : mixed
- Queue a new e-mail message for sending after (n) seconds.
- laterOn() : mixed
- Queue a new e-mail message for sending after (n) seconds on the given queue.
- macro() : void
- Register a custom macro.
- mixin() : void
- Mix another object into the class.
- onQueue() : mixed
- Queue a new e-mail message for sending on the given queue.
- plain() : void
- Send a new message when only a plain part.
- pretend() : void
- Tell the mailer to not really send messages.
- queue() : mixed
- Queue a new e-mail message for sending.
- queueOn() : mixed
- Queue a new e-mail message for sending on the given queue.
- raw() : int
- Send a new message when only a raw text part.
- rawTo() : int
- Helper for raw() method, send a new message when only a raw text part.
- render() : string
- Render the given message as a view.
- send() : mixed
- Send a new message using a view.
- sendTo() : void
- Helper for send() method, the first argument can take a single email or an array of recipients where the key is the address and the value is the name.
- setQueue() : $this
- Set the queue manager instance.
- setSwiftMailer() : void
- Set the Swift Mailer instance.
- to() : PendingMail
- Begin the process of mailing a mailable class instance.
- unbindEvent() : self
- Destroys an event binding.
- addContent() : void
- Add the content to a given message.
- addContentRaw() : void
- Add the raw content to a given message.
- buildQueueMailable() : mixed
- Build the mailable for a queued e-mail job.
- createMessage() : Message
- Create a new message instance.
- dispatchSentEvent() : void
- Dispatch the message sent event.
- emitterEventSortEvents() : array<string|int, mixed>
- Sort the listeners for a given event by priority.
- forceReconnection() : void
- Force the transport to re-connect.
- parseView() : array<string|int, mixed>
- Parse the given view name or array.
- processRecipients() : array<string|int, mixed>
- Process a recipients object, which can look like the following: - (string) admin@domain.tld - (object) ['email' => 'admin@domain.tld', 'name' => 'Adam Person'] - (array) ['admin@domain.tld' => 'Adam Person', ...] - (array) [ (object|array) ['email' => 'admin@domain.tld', 'name' => 'Adam Person'], [...] ]
- renderView() : string
- Render the given view.
- sendMailable() : mixed
- Send the given mailable.
- sendSwiftMessage() : void
- Send a Swift Message instance.
- setGlobalTo() : void
- Set the global "to" address on the given message.
- shouldSendMessage() : bool
- Determines if the message can be sent.
Properties
$emitterEventCollection
protected
array<string|int, mixed>
$emitterEventCollection
= []
Collection of registered events.
$emitterEventSorted
protected
array<string|int, mixed>
$emitterEventSorted
= []
Sorted collection of events.
$emitterSingleEventCollection
protected
array<string|int, mixed>
$emitterSingleEventCollection
= []
Collection of registered events to be fired once only.
$events
The event dispatcher instance.
protected
Dispatcher|null
$events
$failedRecipients
Array of failed recipients.
protected
array<string|int, mixed>
$failedRecipients
= []
$from
The global from address and name.
protected
array<string|int, mixed>
$from
$macros
The registered string macros.
protected
static array<string|int, mixed>
$macros
= []
$pretendingOriginal
protected
string
$pretendingOriginal
Original driver before pretending.
$queue
The queue implementation.
protected
Queue
$queue
$replyTo
The global reply-to address and name.
protected
array<string|int, mixed>
$replyTo
$swift
The Swift Mailer instance.
protected
Swift_Mailer
$swift
$to
The global to address and name.
protected
array<string|int, mixed>
$to
$views
The view factory instance.
protected
Factory
$views
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__construct()
Create a new Mailer instance.
public
__construct(Factory $views, Swift_Mailer $swift[, Dispatcher|null $events = null ]) : void
Parameters
- $views : Factory
- $swift : Swift_Mailer
- $events : Dispatcher|null = null
Return values
void —alwaysFrom()
Set the global from address and name.
public
alwaysFrom(string $address[, string|null $name = null ]) : void
Parameters
- $address : string
- $name : string|null = null
Return values
void —alwaysReplyTo()
Set the global reply-to address and name.
public
alwaysReplyTo(string $address[, string|null $name = null ]) : void
Parameters
- $address : string
- $name : string|null = null
Return values
void —alwaysTo()
Set the global to address and name.
public
alwaysTo(string $address[, string|null $name = null ]) : void
Parameters
- $address : string
- $name : string|null = null
Return values
void —bcc()
Begin the process of mailing a mailable class instance.
public
bcc(mixed $users) : PendingMail
Parameters
- $users : mixed
Return values
PendingMail —bindEvent()
Create a new event binding.
public
bindEvent(mixed $event, mixed $callback, mixed $priority) : self
Parameters
- $event : mixed
- $callback : mixed
- $priority : mixed
Return values
self —bindEventOnce()
Create a new event binding that fires once only
public
bindEventOnce(mixed $event, mixed $callback) : self
Parameters
- $event : mixed
- $callback : mixed
Return values
self —failures()
Get the array of failed recipients.
public
failures() : array<string|int, mixed>
Return values
array<string|int, mixed> —fireEvent()
Fire an event and call the listeners.
public
fireEvent(string $event[, array<string|int, mixed> $params = [] ][, bool $halt = false ]) : array<string|int, mixed>
Parameters
- $event : string
-
Event name
- $params : array<string|int, mixed> = []
-
Event parameters
- $halt : bool = false
-
Halt after first non-null result
Return values
array<string|int, mixed> —Collection of event results / Or single result (if halted)
getSwiftMailer()
Get the Swift Mailer instance.
public
getSwiftMailer() : Swift_Mailer
Return values
Swift_Mailer —getViewFactory()
Get the view factory instance.
public
getViewFactory() : Factory
Return values
Factory —hasMacro()
Checks if macro is registered.
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
bool —later()
Queue a new e-mail message for sending after (n) seconds.
public
later(int $delay, string|array<string|int, mixed> $view[, array<string|int, mixed> $data = null ][, Closure|string $callback = null ][, string|null $queue = null ]) : mixed
Parameters
- $delay : int
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = null
- $callback : Closure|string = null
- $queue : string|null = null
Return values
mixed —laterOn()
Queue a new e-mail message for sending after (n) seconds on the given queue.
public
laterOn(string $queue, int $delay, string|array<string|int, mixed> $view[, array<string|int, mixed> $data = null ][, Closure|string $callback = null ]) : mixed
Parameters
- $queue : string
- $delay : int
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = null
- $callback : Closure|string = null
Return values
mixed —macro()
Register a custom macro.
public
static macro(string $name, object|callable $macro) : void
Parameters
- $name : string
- $macro : object|callable
Return values
void —mixin()
Mix another object into the class.
public
static mixin(object $mixin) : void
Parameters
- $mixin : object
Return values
void —onQueue()
Queue a new e-mail message for sending on the given queue.
public
onQueue(string $queue, string|array<string|int, mixed> $view) : mixed
Parameters
- $queue : string
- $view : string|array<string|int, mixed>
Return values
mixed —plain()
Send a new message when only a plain part.
public
plain(string $view, array<string|int, mixed> $data, mixed $callback) : void
Parameters
- $view : string
- $data : array<string|int, mixed>
- $callback : mixed
Return values
void —pretend()
Tell the mailer to not really send messages.
public
pretend([bool $value = true ]) : void
Parameters
- $value : bool = true
Return values
void —queue()
Queue a new e-mail message for sending.
public
queue(string|array<string|int, mixed> $view[, array<string|int, mixed> $data = null ][, Closure|string $callback = null ][, string|null $queue = null ]) : mixed
Parameters
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = null
- $callback : Closure|string = null
- $queue : string|null = null
Return values
mixed —queueOn()
Queue a new e-mail message for sending on the given queue.
public
queueOn(string $queue, string|array<string|int, mixed> $view[, array<string|int, mixed> $data = null ][, Closure|string $callback = null ]) : mixed
Parameters
- $queue : string
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = null
- $callback : Closure|string = null
Return values
mixed —raw()
Send a new message when only a raw text part.
public
raw(mixed $view, mixed $callback) : int
Parameters
- $view : mixed
- $callback : mixed
Return values
int —rawTo()
Helper for raw() method, send a new message when only a raw text part.
public
rawTo(array<string|int, mixed> $recipients, string $view[, mixed $callback = null ][, array<string|int, mixed> $options = [] ]) : int
Parameters
- $recipients : array<string|int, mixed>
- $view : string
- $callback : mixed = null
- $options : array<string|int, mixed> = []
Return values
int —render()
Render the given message as a view.
public
render(string|array<string|int, mixed> $view[, array<string|int, mixed> $data = [] ]) : string
Parameters
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = []
Return values
string —send()
Send a new message using a view.
public
send(string|array<string|int, mixed> $view[, array<string|int, mixed> $data = [] ][, Closure|string $callback = null ]) : mixed
Parameters
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = []
- $callback : Closure|string = null
Return values
mixed —sendTo()
Helper for send() method, the first argument can take a single email or an array of recipients where the key is the address and the value is the name.
public
sendTo(array<string|int, mixed> $recipients, string|array<string|int, mixed> $view[, array<string|int, mixed> $data = [] ][, mixed $callback = null ][, array<string|int, mixed> $options = [] ]) : void
Parameters
- $recipients : array<string|int, mixed>
- $view : string|array<string|int, mixed>
- $data : array<string|int, mixed> = []
- $callback : mixed = null
- $options : array<string|int, mixed> = []
Return values
void —setQueue()
Set the queue manager instance.
public
setQueue(Factory $queue) : $this
Parameters
- $queue : Factory
Return values
$this —setSwiftMailer()
Set the Swift Mailer instance.
public
setSwiftMailer(Swift_Mailer $swift) : void
Parameters
- $swift : Swift_Mailer
Return values
void —to()
Begin the process of mailing a mailable class instance.
public
to(mixed $users) : PendingMail
Parameters
- $users : mixed
Return values
PendingMail —unbindEvent()
Destroys an event binding.
public
unbindEvent([string $event = null ]) : self
Parameters
- $event : string = null
-
Event to destroy
Return values
self —addContent()
Add the content to a given message.
protected
addContent(Message $message, string $view, string $plain, string $raw, array<string|int, mixed> $data) : void
Parameters
- $message : Message
- $view : string
- $plain : string
- $raw : string
- $data : array<string|int, mixed>
Return values
void —addContentRaw()
Add the raw content to a given message.
protected
addContentRaw(Message $message, string $html, string $text) : void
Parameters
- $message : Message
- $html : string
- $text : string
Return values
void —buildQueueMailable()
Build the mailable for a queued e-mail job.
protected
buildQueueMailable(mixed $view, mixed $data, mixed $callback[, mixed $queueName = null ]) : mixed
Parameters
- $view : mixed
- $data : mixed
- $callback : mixed
- $queueName : mixed = null
Return values
mixed —createMessage()
Create a new message instance.
protected
createMessage() : Message
Return values
Message —dispatchSentEvent()
Dispatch the message sent event.
protected
dispatchSentEvent(Message $message) : void
Parameters
- $message : Message
Return values
void —emitterEventSortEvents()
Sort the listeners for a given event by priority.
protected
emitterEventSortEvents(string $eventName) : array<string|int, mixed>
Parameters
- $eventName : string
Return values
array<string|int, mixed> —forceReconnection()
Force the transport to re-connect.
protected
forceReconnection() : void
This will prevent errors in daemon queue situations.
Return values
void —parseView()
Parse the given view name or array.
protected
parseView(string|array<string|int, mixed> $view) : array<string|int, mixed>
Parameters
- $view : string|array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —processRecipients()
Process a recipients object, which can look like the following: - (string) admin@domain.tld - (object) ['email' => 'admin@domain.tld', 'name' => 'Adam Person'] - (array) ['admin@domain.tld' => 'Adam Person', ...] - (array) [ (object|array) ['email' => 'admin@domain.tld', 'name' => 'Adam Person'], [...] ]
protected
processRecipients(mixed $recipients) : array<string|int, mixed>
Parameters
- $recipients : mixed
Return values
array<string|int, mixed> —renderView()
Render the given view.
protected
renderView(string $view, array<string|int, mixed> $data) : string
Parameters
- $view : string
- $data : array<string|int, mixed>
Return values
string —sendMailable()
Send the given mailable.
protected
sendMailable(Mailable $mailable) : mixed
Parameters
- $mailable : Mailable
Return values
mixed —sendSwiftMessage()
Send a Swift Message instance.
protected
sendSwiftMessage(Swift_Message $message) : void
Parameters
- $message : Swift_Message
Return values
void —setGlobalTo()
Set the global "to" address on the given message.
protected
setGlobalTo(Message $message) : void
Parameters
- $message : Message
Return values
void —shouldSendMessage()
Determines if the message can be sent.
protected
shouldSendMessage(Swift_Message $message) : bool
Parameters
- $message : Swift_Message