Mailer

Mailer class for sending mail.

 class Winter\Storm\Mail\Mailer
extends Illuminate\Mail\Mailer

Extends

Class Description
Illuminate\Mail\Mailer

Traits

Trait Description
Emitter

Adds event related features to any class.

Properties

protected $pretendingOriginal : string

Original driver before pretending.

inherited protected $emitterEventCollection : array

Inherited from Emitter

Collection of registered events.

inherited protected $emitterEventSorted : array

Inherited from Emitter

Sorted collection of events.

inherited protected $emitterSingleEventCollection : array

Inherited from Emitter

Collection of registered events to be fired once only.

Methods

public later (int $delay, MailableContract | string | array $view, array $data = null, Closure | string $callback = null, string | null $queue = null) : mixed

Queue a new e-mail message for sending after (n) seconds.

Parameters
Property Description
$delay
int
$view
MailableContract | string | array
$data
array
$callback
Closure | string
$queue
string | null
Returns
mixed

public laterOn (string $queue, int $delay, string | array $view, array $data = null, Closure | string $callback = null) : mixed

Queue a new e-mail message for sending after (n) seconds on the given queue.

Parameters
Property Description
$queue
string
$delay
int
$view
string | array
$data
array
$callback
Closure | string
Returns
mixed

public pretend (boolean $value = true) : void

Tell the mailer to not really send messages.

Parameters
Property Description
$value
boolean
Returns
void

public queue (MailableContract | string | array $view, array $data = null, Closure | string $callback = null, string | null $queue = null) : mixed

Queue a new e-mail message for sending.

Parameters
Property Description
$view
MailableContract | string | array
$data
array
$callback
Closure | string
$queue
string | null
Returns
mixed

public queueOn (string $queue, string | array $view, array $data = null, Closure | string $callback = null) : mixed

Queue a new e-mail message for sending on the given queue.

Parameters
Property Description
$queue
string
$view
string | array
$data
array
$callback
Closure | string
Returns
mixed

public raw (string | array $view, mixed $callback) : Illuminate\Mail\SentMessage | null

Send a new message when only a raw text part.

Parameters
Property Description
$view
string | array
$callback
mixed
Returns
Illuminate\Mail\SentMessage | null

public rawTo (array $recipients, array | string $view, mixed $callback = null, array $options = []) : Illuminate\Mail\SentMessage | null

Helper for raw() method, send a new message when only a raw text part.

Parameters
Property Description
$recipients
array
$view
array | string
$callback
mixed
$options
array
Returns
Illuminate\Mail\SentMessage | null

public send (Illuminate\Contracts\Mail\Mailable | string | array $view, array $data = [], Closure | string | null $callback = null) : Illuminate\Mail\SentMessage | null

Send a new message using a view.

Overrides the Laravel defaults to provide the following functionality:

  • Events (global & local):
  • mailer.beforeSend
  • mailer.prepareSend
  • mailer.send
  • Custom addContent() behavior
  • Support for bypassing all addContent behavior when passing $view['raw' => true]
Parameters
Property Description
$view
Illuminate\Contracts\Mail\Mailable | string | array
$data
array
$callback
Closure | string | null
Returns
Illuminate\Mail\SentMessage | null

public sendTo (array $recipients, string | array $view, array $data = [], mixed $callback = null, array $options = []) : mixed

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.

Parameters
Property Description
$recipients
array
$view
string | array
$data
array
$callback
mixed
$options
array
Returns
mixed

protected addContent (Illuminate\Mail\Message $message, string | null $view = null, string | null $plain = null, string | null $raw = null, array | null $data = null) : void

Add the content to a given message.

Overrides the Laravel defaults to provide the following functionality:

  • Events (global & local):
  • mailer.beforeAddContent
  • mailer.addContent
  • Support for the Winter MailParser
Parameters
Property Description
$message
Illuminate\Mail\Message
$view
string | null
$plain
string | null
$raw
string | null
$data
array | null
Returns
void

protected addContentRaw (Illuminate\Mail\Message $message, string | null $html = null, string | null $text = null) : void

Add the raw content to the provided message.

Parameters
Property Description
$message
Illuminate\Mail\Message
$html
string | null
$text
string | null
Returns
void

protected buildQueueMailable ($view, $data, mixed $callback, $queueName = null) : mixed

Build the mailable for a queued e-mail job.

Parameters
Property Description
$view
mixed
$data
mixed
$callback
mixed
$queueName
mixed
Returns
mixed

protected processRecipients (mixed $recipients) : array

Process a recipients object, which can look like the following:

Parameters
Property Description
$recipients
mixed
Returns
array

inherited public bindEvent (string | Closure | QueuedClosure $event, mixed $callback = null, integer $priority) : self

Inherited from Emitter

Create a new event binding.

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
mixed

when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority variable

$priority
integer
Returns
self

inherited public bindEventOnce (string | Closure | QueuedClosure $event, QueuedClosure | Closure | null $callback = null) : self

Inherited from Emitter

Create a new event binding that fires once only

Parameters
Property Description
$event
string | Closure | QueuedClosure
$callback
QueuedClosure | Closure | null

When a Closure or QueuedClosure is provided as the first parameter this parameter can be omitted

Returns
self

inherited public fireEvent (string $event, array $params = [], boolean $halt = false) : array | mixed | null

Inherited from Emitter

Fire an event and call the listeners.

Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

$halt
boolean

Halt after first non-null result

Returns
array | mixed | null

If halted, the first non-null result. If not halted, an array of event results. Returns null if no listeners returned a result.

inherited public unbindEvent (string | array | object $event = null) : self

Inherited from Emitter

Destroys an event binding.

Parameters
Property Description
$event
string | array | object

Event to destroy

Returns
self

inherited protected emitterEventSortEvents (string $eventName) : void

Inherited from Emitter

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void

inherited protected parseEventAndPayload (mixed $event, mixed $payload = null) : array

Inherited from Emitter

Parse the given event and payload and prepare them for dispatching.

Parameters
Property Description
$event
mixed
$payload
mixed
Returns
array
Copyright © 2024 Winter CMS