System\Classes\MailManager

Overview

MailManager manages Mail sending functions


Protected Properties

protected array $templateCache

A cache of customized mail templates.

protected array $registeredTemplates

List of registered templates in the system

protected array $registeredPartials

List of registered partials in the system

protected array $registeredLayouts

List of registered layouts in the system

protected bool $isHtmlRenderMode

Internal marker for rendering mode


Public Methods

public addContentFromEvent()

public addContentFromEvent(
    $message,
    $view = null,
    $plain = null,
    $raw = null,
    $data = []
): void

addContentFromEvent handles adding content from the mailer.beforeAddContent event

public addContentToMailer()

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

addContentToMailer function hijacks the addContent method of the October\Rain\Mail\Mailer class, using the mailer.beforeAddContent event.

public addRawContentToMailer()

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

addRawContentToMailer is the same as addContentToMailer except with raw content

public getViewPathForTemplate()

public getViewPathForTemplate($code): string|null 

getViewPathForTemplate returns a view path for a registered template

public static instance()

public static instance(): static 

instance creates a new instance of this singleton

public listRegisteredLayouts()

public listRegisteredLayouts(): array 

listRegisteredLayouts returns a list of the registered layouts.

public listRegisteredPartials()

public listRegisteredPartials(): array 

listRegisteredPartials returns a list of the registered partials.

public listRegisteredTemplates()

public listRegisteredTemplates(): array 

listRegisteredTemplates returns a list of the registered templates.

public loadRegisteredTemplates()

public loadRegisteredTemplates(): void 

loadRegisteredTemplates loads registered mail templates from modules and plugins

public static registerCallback()

public static registerCallback(callable $callback): void

registerCallback 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([...]);
});

public registerMailLayouts()

public registerMailLayouts($definitions): void

registerMailLayouts registers mail views and manageable layouts.

public registerMailPartials()

public registerMailPartials($definitions): void

registerMailPartials registers mail views and manageable layouts.

public registerMailTemplates()

public registerMailTemplates($definitions): void

registerMailTemplates registers mail views and manageable templates.

public render()

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

render the Markdown template into HTML

public renderPartial()

public renderPartial($code, $params = []): void

public renderTemplate()

public renderTemplate($template, $data = []): void

public renderText()

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

renderText renders the Markdown template into text.

public renderTextTemplate()

public renderTextTemplate($template, $data = []): void

Protected Methods

protected addContentToMailerInternal()

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

addContentToMailerInternal is an internal method used to share logic between addRawContentToMailer and addContentToMailer

protected parseTwig()

protected parseTwig($contents, $vars = []): void

parseTwig parses Twig using the mailer environment