API / Minn\Mail / HtmlMessage

HtmlMessage final class

Minn\Mail\HtmlMessage · public/minn/src/Minn/Mail/HtmlMessage.php · 55 lines

What a mailer reads out of an HTML message: the images it can carry inline (a src or background naming a file under the base directory, or a data: URI of a raster image), the content id each one gets (the first 32 hex digits of a SHA-256 of the URL, or of a data URI's bytes, at "phpmailer.0"), and the plain-text version (head, style and script dropped, tags stripped, entities decoded into the charset).

Constants and properties

constNO_TEXT = 'This is an HTML-only message. To view it, activate HTML in your email application.'

Public

staticimages(string $html): array#

Every quoted src or background value, in document order.

@return list<array{attribute: string, url: string}>
staticdataImage(string $url): ?array#

A data: URI's bytes and type when it is a raster image, else null.

@return array{0: string, 1: string}|null
staticlocalPath(string $url): ?string#

A relative path with no scheme and no step up out of the base directory, or null.

staticcid(string $source): string#

The content id the mailer gives an image.

statictext(string $html, string $charset): string#

The plain-text version of an HTML message.