API / Minn\Mail / MailHeaders

MailHeaders final readonly class

Minn\Mail\MailHeaders · public/minn/src/Minn/Mail/MailHeaders.php · 83 lines

The headers argument of wp_mail() read the way the reference reads it: a string split into lines (CRLF or LF) or a list of lines; a line without a colon is skipped. From gives an address and a name (quotes dropped); Cc, Bcc and Reply-To add comma-separated entries (a comma inside quotes still splits); Content-Type gives a type and either a charset or a boundary (a boundary leaves the charset empty); every other header is kept by name, the last of a name winning.

Constants and properties

propreadonly ?string $fromEmail

Promoted from the constructor.

propreadonly ?string $fromName

Promoted from the constructor.

propreadonly array $cc

Promoted from the constructor.

propreadonly array $bcc

Promoted from the constructor.

propreadonly array $replyTo

Promoted from the constructor.

propreadonly ?string $contentType

Promoted from the constructor.

propreadonly ?string $charset

Promoted from the constructor.

propreadonly string $boundary

Promoted from the constructor.

propreadonly array $custom

Promoted from the constructor.

Public

new__construct(?string $fromEmail, ?string $fromName, array $cc, array $bcc, array $replyTo, ?string $contentType, ?string $charset, string $boundary, array $custom)#
$cclist<string>
$bcclist<string>
$replyTolist<string>
$customarray<string, string>
staticparse(mixed $headers): self#

The headers argument, as a string of lines or a list of them.

staticrecipient(string $entry): array#

One recipient entry as [address, name]: "Name <address>" (the name as written) or a bare address.

@return array{0: string, 1: string}

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatefrom(string $content): array#
@return array{0: string|null, 1: string|null}
privatecontentType(string $content, array $current): array#
$currentarray{0: string|null, 1: string|null, 2: string}
@return array{0: string|null, 1: string|null, 2: string}