MailManager

This class manages Mail sending functions

 class System\Classes\MailManager

Traits

Trait Description
Singleton

Singleton trait.

Properties

protected $callbacks : array

Cache of registration callbacks.

protected $isHtmlRenderMode : bool

Internal marker for rendering mode

protected $registeredLayouts : array

List of registered layouts in the system

protected $registeredPartials : array

List of registered partials in the system

protected $registeredTemplates : array

List of registered templates in the system

protected $templateCache : array

A cache of customised mail templates.

Methods

public addContentToMailer (Illuminate\Mail\Message $message, string $code, array $data, boolean $plainOnly = false) : bool

This function hijacks the addContent method of the Winter\Storm\Mail\Mailer class, using the mailer.beforeAddContent event.

Parameters
Property Description
$message
Illuminate\Mail\Message
$code
string
$data
array
$plainOnly
boolean

Add only plain text content to the message

Returns
bool

public addRawContentToMailer ($message, $content, $data) : bool

Same as addContentToMailer except with raw content.

Parameters
Property Description
$message
mixed
$content
mixed
$data
mixed
Returns
bool

public listRegisteredLayouts () : array

Returns a list of the registered layouts.

Returns
array

public listRegisteredPartials () : array

Returns a list of the registered partials.

Returns
array

public listRegisteredTemplates () : array

Returns a list of the registered templates.

Returns
array

public loadRegisteredTemplates () : void

Loads registered mail templates from modules and plugins

Returns
void

public registerCallback (callable $callback)

Registers a callback function that defines mail templates.

The callback function should register templates by calling the manager's registerMailTemplates() function. Thi instance is passed to the callback function as an argument. Usage:

MailManager::registerCallback(function ($manager) {
    $manager->registerMailTemplates([...]);
});
Parameters
Property Description
$callback
callable

A callable function.

Returns
mixed

public registerMailLayouts (array $definitions)

Registers mail views and manageable layouts.

Parameters
Property Description
$definitions
array
Returns
mixed

public registerMailPartials (array $definitions)

Registers mail views and manageable layouts.

Parameters
Property Description
$definitions
array
Returns
mixed

public registerMailTemplates (array $definitions)

Registers mail views and manageable templates.

Parameters
Property Description
$definitions
array
Returns
mixed

public render (string $content, array $data = []) : string

Render the Markdown template into HTML.

Parameters
Property Description
$content
string
$data
array
Returns
string

public renderPartial ($code, array $params = [])

Parameters
Property Description
$code
mixed
$params
array
Returns
mixed

public renderTemplate ($template, array $data = [])

Parameters
Property Description
$template
mixed
$data
array
Returns
mixed

public renderText ($content, array $data = []) : string

Render the Markdown template into text.

Parameters
Property Description
$content
mixed
$data
array
Returns
string

public renderTextTemplate ($template, array $data = [])

Parameters
Property Description
$template
mixed
$data
array
Returns
mixed

protected addContentToMailerInternal (Illuminate\Mail\Message $message, string $template, array $data, boolean $plainOnly = false) : void

Internal method used to share logic between addRawContentToMailer and addContentToMailer

Parameters
Property Description
$message
Illuminate\Mail\Message
$template
string
$data
array
$plainOnly
boolean

Add only plain text content to the message

Returns
void

protected renderTwig (string $content, array $data = []) : string

Internal helper for rendering Twig using the mailer Twig environment

Parameters
Property Description
$content
string
$data
array
Returns
string

public __clone ()

Inherited from Singleton
Returns
mixed

public __wakeup ()

Inherited from Singleton
Returns
mixed

public static final forgetInstance ($container = null) : void

Inherited from Singleton

Forget this singleton's instance if it exists

Parameters
Property Description
$container
mixed
Returns
void

public static final instance ($container = null) : static

Inherited from Singleton

Create a new instance of this singleton.

Parameters
Property Description
$container
mixed
Returns
static

protected final __construct ()

Inherited from Singleton

Constructor.

Returns
mixed

protected init ()

Inherited from Singleton

Initialize the singleton free from constructor parameters.

Returns
mixed
Copyright © 2024 Winter CMS