MailParser

This class parses Mail templates.

 class Winter\Storm\Mail\MailParser

Returns the structured file information.

Constants

Constant Description
SECTION_SEPARATOR
string "=="

Methods

public static parse (string $content) : array

Parses Mail template content.

The expected file format is following:

Settings section
==
Plain-text content section
==
HTML content section

If the content has only 2 sections they are considered as settings and HTML. If there is only a single section, it is considered as HTML.

Parameters
Property Description
$content
string

Specifies the file content.

Returns
array

Returns an array with the following indexes: 'settings', 'html', 'text'. The 'html' and 'text' elements contain strings. The 'settings' element contains the parsed INI file as array. If the content string doesn't contain a section, the corresponding result element has null value.

Copyright © 2024 Winter CMS