class Mailer extends Mailer

Adapted from october\rain\mail\Mailer

Traits

Adds event related features to any class.

Properties

protected array $emitterSingleEvents from  EventEmitter
protected array $emitterEvents from  EventEmitter
protected array $emitterEventSorted from  EventEmitter
protected string $pretendingOriginal

Methods

bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

void
emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

unbindEvent(string $event = null)

Destroys an event binding.

string|array
fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

void
send(string|array $view, array $data = [], Closure|string $callback = null)

Send a new message using a view.

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

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.

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

Queue a new e-mail message for sending.

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

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

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

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

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

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

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

Build the mailable for a queued e-mail job.

void
raw($view, mixed $callback)

Send a new message when only a raw text part.

int
rawTo(array $recipients, string $view, mixed $callback = null, array $options = [])

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

array
processRecipients(mixed $recipients)

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

void
addContent(Message $message, string $view, string $plain, string $raw, array $data)

Add the content to a given message.

void
addContentRaw(Message $message, string $html, string $text)

Add the raw content to a given message.

void
pretend(bool $value = true)

Tell the mailer to not really send messages.

sendToMany($recipients, $view, array $data = [], $callback = null, $queue = false)

No description

parseView($view)

No description

Details

in EventEmitter at line 36
EventEmitter bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

Parameters

string $event

The event name to listen for

callable $callback

The callback to call when emitted

int $priority

Return Value

EventEmitter

in EventEmitter at line 52
EventEmitter bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

Parameters

string $event

The event name

callable $callback

Return Value

EventEmitter

in EventEmitter at line 66
protected void emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

Parameters

string $eventName

Return Value

void

in EventEmitter at line 84
EventEmitter unbindEvent(string $event = null)

Destroys an event binding.

Parameters

string $event

Event to destroy

Return Value

EventEmitter

in EventEmitter at line 124
string|array fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

string|array

Collection of event results / Or single result (if halted)

in EventEmitter at line 178
mixed fireSystemEvent(string $event, array $params = [], bool $halt = true)

Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.

For example:

$this->fireSystemEvent('admin.form.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('form.myEvent', ['myvalue'], true);

Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

mixed

at line 33
void send(string|array $view, array $data = [], Closure|string $callback = null)

Send a new message using a view.

Parameters

string|array $view
array $data
Closure|string $callback

Return Value

void

at line 145
mixed sendTo(array $recipients, string|array $view, array $data = [], mixed $callback = null, array $options = [])

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

array $recipients
string|array $view
array $data
mixed $callback
array $options

Return Value

mixed

at line 187
mixed queue(string|array $view, array $data = null, Closure|string $callback = null, string|null $queue = null)

Queue a new e-mail message for sending.

Parameters

string|array $view
array $data
Closure|string $callback
string|null $queue

Return Value

mixed

at line 210
mixed queueOn(string $queue, string|array $view, array $data = null, Closure|string $callback = null)

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

Parameters

string $queue
string|array $view
array $data
Closure|string $callback

Return Value

mixed

at line 225
mixed later(int $delay, string|array $view, array $data = null, Closure|string $callback = null, string|null $queue = null)

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

Parameters

int $delay
string|array $view
array $data
Closure|string $callback
string|null $queue

Return Value

mixed

at line 249
mixed laterOn(string $queue, int $delay, string|array $view, array $data = null, Closure|string $callback = null)

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

Parameters

string $queue
int $delay
string|array $view
array $data
Closure|string $callback

Return Value

mixed

at line 260
protected mixed buildQueueMailable($view, $data, mixed $callback, $queueName = null)

Build the mailable for a queued e-mail job.

Parameters

$view
$data
mixed $callback
$queueName

Return Value

mixed

at line 284
void raw($view, mixed $callback)

Send a new message when only a raw text part.

Parameters

$view
mixed $callback

Return Value

void

at line 304
int rawTo(array $recipients, string $view, mixed $callback = null, array $options = [])

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

Parameters

array $recipients
string $view
mixed $callback
array $options

Return Value

int

at line 325
protected array processRecipients(mixed $recipients)

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

Parameters

mixed $recipients

Return Value

array

at line 376
protected void addContent(Message $message, string $view, string $plain, string $raw, array $data)

Add the content to a given message.

Parameters

Message $message
string $view
string $plain
string $raw
array $data

Return Value

void

at line 463
protected void addContentRaw(Message $message, string $html, string $text)

Add the raw content to a given message.

Parameters

Message $message
string $html
string $text

Return Value

void

at line 480
void pretend(bool $value = true)

Tell the mailer to not really send messages.

Parameters

bool $value

Return Value

void

at line 492
sendToMany($recipients, $view, array $data = [], $callback = null, $queue = false)

No description

Parameters

$recipients
$view
array $data
$callback
$queue

at line 512
protected parseView($view)

No description

Parameters

$view