MailManager
in package
Uses
Singleton
This class manages Mail sending functions
Tags
Table of Contents
- $callbacks : array<string|int, mixed>
- $instance : mixed
- $isHtmlRenderMode : bool
- $isTwigStarted : bool
- $registeredLayouts : array<string|int, mixed>
- $registeredPartials : array<string|int, mixed>
- $registeredTemplates : array<string|int, mixed>
- $templateCache : array<string|int, mixed>
- __clone() : mixed
- __wakeup() : mixed
- addContentToMailer() : bool
- This function hijacks the `addContent` method of the `October\Rain\Mail\Mailer` class, using the `mailer.beforeAddContent` event.
- addRawContentToMailer() : bool
- Same as `addContentToMailer` except with raw content.
- forgetInstance() : mixed
- Forget this singleton's instance if it exists
- instance() : mixed
- Create a new instance of this singleton.
- listRegisteredLayouts() : array<string|int, mixed>
- Returns a list of the registered layouts.
- listRegisteredPartials() : array<string|int, mixed>
- Returns a list of the registered partials.
- listRegisteredTemplates() : array<string|int, mixed>
- Returns a list of the registered templates.
- loadRegisteredTemplates() : void
- Loads registered mail templates from modules and plugins
- registerCallback() : mixed
- Registers a callback function that defines mail templates.
- registerMailLayouts() : mixed
- Registers mail views and manageable layouts.
- registerMailPartials() : mixed
- Registers mail views and manageable layouts.
- registerMailTemplates() : mixed
- Registers mail views and manageable templates.
- render() : string
- Render the Markdown template into HTML.
- renderPartial() : mixed
- renderTemplate() : mixed
- renderText() : string
- Render the Markdown template into text.
- renderTextTemplate() : mixed
- __construct() : mixed
- Constructor.
- addContentToMailerInternal() : void
- Internal method used to share logic between `addRawContentToMailer` and `addContentToMailer`
- init() : mixed
- Initialize the singleton free from constructor parameters.
- renderTwig() : mixed
- Internal helper for rendering Twig
- startTwig() : void
- Temporarily registers mail based token parsers with Twig.
- stopTwig() : void
- Indicates that we are finished with Twig.
Properties
$callbacks
protected
array<string|int, mixed>
$callbacks
= []
Cache of registration callbacks.
$instance
protected
static mixed
$instance
$isHtmlRenderMode
protected
bool
$isHtmlRenderMode
= false
Internal marker for rendering mode
$isTwigStarted
protected
bool
$isTwigStarted
= false
Internal marker for booting custom twig extensions.
$registeredLayouts
protected
array<string|int, mixed>
$registeredLayouts
List of registered layouts in the system
$registeredPartials
protected
array<string|int, mixed>
$registeredPartials
List of registered partials in the system
$registeredTemplates
protected
array<string|int, mixed>
$registeredTemplates
List of registered templates in the system
$templateCache
protected
array<string|int, mixed>
$templateCache
= []
A cache of customised mail templates.
Methods
__clone()
public
__clone() : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —addContentToMailer()
This function hijacks the `addContent` method of the `October\Rain\Mail\Mailer` class, using the `mailer.beforeAddContent` event.
public
addContentToMailer(Message $message, string $code, array<string|int, mixed> $data[, bool $plainOnly = false ]) : bool
Parameters
- $message : Message
- $code : string
- $data : array<string|int, mixed>
- $plainOnly : bool = false
-
Add only plain text content to the message
Return values
bool —addRawContentToMailer()
Same as `addContentToMailer` except with raw content.
public
addRawContentToMailer(mixed $message, mixed $content, mixed $data) : bool
Parameters
- $message : mixed
- $content : mixed
- $data : mixed
Return values
bool —forgetInstance()
Forget this singleton's instance if it exists
public
final static forgetInstance() : mixed
Return values
mixed —instance()
Create a new instance of this singleton.
public
final static instance() : mixed
Return values
mixed —listRegisteredLayouts()
Returns a list of the registered layouts.
public
listRegisteredLayouts() : array<string|int, mixed>
Return values
array<string|int, mixed> —listRegisteredPartials()
Returns a list of the registered partials.
public
listRegisteredPartials() : array<string|int, mixed>
Return values
array<string|int, mixed> —listRegisteredTemplates()
Returns a list of the registered templates.
public
listRegisteredTemplates() : array<string|int, mixed>
Return values
array<string|int, mixed> —loadRegisteredTemplates()
Loads registered mail templates from modules and plugins
public
loadRegisteredTemplates() : void
Return values
void —registerCallback()
Registers a callback function that defines mail templates.
public
registerCallback(callable $callback) : mixed
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
- $callback : callable
-
A callable function.
Return values
mixed —registerMailLayouts()
Registers mail views and manageable layouts.
public
registerMailLayouts(array<string|int, mixed> $definitions) : mixed
Parameters
- $definitions : array<string|int, mixed>
Return values
mixed —registerMailPartials()
Registers mail views and manageable layouts.
public
registerMailPartials(array<string|int, mixed> $definitions) : mixed
Parameters
- $definitions : array<string|int, mixed>
Return values
mixed —registerMailTemplates()
Registers mail views and manageable templates.
public
registerMailTemplates(array<string|int, mixed> $definitions) : mixed
Parameters
- $definitions : array<string|int, mixed>
Return values
mixed —render()
Render the Markdown template into HTML.
public
render(string $content[, array<string|int, mixed> $data = [] ]) : string
Parameters
- $content : string
- $data : array<string|int, mixed> = []
Return values
string —renderPartial()
public
renderPartial(mixed $code[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $code : mixed
- $params : array<string|int, mixed> = []
Return values
mixed —renderTemplate()
public
renderTemplate(mixed $template[, mixed $data = [] ]) : mixed
Parameters
- $template : mixed
- $data : mixed = []
Return values
mixed —renderText()
Render the Markdown template into text.
public
renderText( $content[, array<string|int, mixed> $data = [] ]) : string
Parameters
Return values
string —renderTextTemplate()
public
renderTextTemplate(mixed $template[, mixed $data = [] ]) : mixed
Parameters
- $template : mixed
- $data : mixed = []
Return values
mixed —__construct()
Constructor.
protected
final __construct() : mixed
Return values
mixed —addContentToMailerInternal()
Internal method used to share logic between `addRawContentToMailer` and `addContentToMailer`
protected
addContentToMailerInternal(Message $message, string $template, array<string|int, mixed> $data[, bool $plainOnly = false ]) : void
Parameters
- $message : Message
- $template : string
- $data : array<string|int, mixed>
- $plainOnly : bool = false
-
Add only plain text content to the message
Return values
void —init()
Initialize the singleton free from constructor parameters.
protected
init() : mixed
Return values
mixed —renderTwig()
Internal helper for rendering Twig
protected
renderTwig(mixed $content[, mixed $data = [] ]) : mixed
Parameters
- $content : mixed
- $data : mixed = []
Return values
mixed —startTwig()
Temporarily registers mail based token parsers with Twig.
protected
startTwig() : void
Return values
void —stopTwig()
Indicates that we are finished with Twig.
protected
stopTwig() : void