Skip to content
PHP Ecosystem
Explore

MailEntry

API reference › Debug Core › Panel › Mail › MailEntry

final classPHPForge\Debug\Panel\Mail\MailEntry
ImplementsPHPForge\Debug\Storage\PanelRow
Sourcesrc/Panel/Mail/MailEntry.php

Typed view-model for a single mail message rendered in the Mail panel detail view.

MethodDescriptionDefined by
create() staticCreates a captured message from the envelope fields every mailer reports.MailEntry
failedCount() staticCounts the messages the mailer rejected.MailEntry
fromArray() staticNarrows one persisted message of the mail payload into a typed entry.MailEntry
fromCapture() staticNarrows one captured EVENT_AFTER_SEND payload into a typed message.MailEntry
getBcc()Returns the blind carbon-copy recipients.MailEntry
getBody()Returns the captured plain-text body.MailEntry
getCc()Returns the carbon-copy recipients.MailEntry
getCharset()Returns the charset declared on the message.MailEntry
getFile()Returns the path of the message the mailer persisted.MailEntry
getFrom()Returns the sender address as captured.MailEntry
getHeaders()Returns the raw message headers as captured.MailEntry
getReplyTo()Returns the reply-to addresses.MailEntry
getSubject()Returns the subject line as captured.MailEntry
getTime()Returns the capture timestamp.MailEntry
getTo()Returns the primary recipients.MailEntry
isSuccessful()Reports whether the mailer delivered the message.MailEntry
jsonSerialize()Serializes the message into its persisted payload.MailEntry
withBcc()Returns a copy with the blind carbon-copy recipients.MailEntry
withBody()Returns a copy with the captured body.MailEntry
withCc()Returns a copy with the carbon-copy recipients.MailEntry
withCharset()Returns a copy with the declared charset.MailEntry
withFile()Returns a copy with the persisted message file.MailEntry
withHeaders()Returns a copy with the raw message headers.MailEntry
withReplyTo()Returns a copy with the reply-to addresses.MailEntry
withTime()Returns a copy with the capture timestamp.MailEntry
public static function create(string $from, list<string> $to, string $subject, bool $isSuccessful): self

Creates a captured message from the envelope fields every mailer reports.

Parameters

ParameterTypeDescription
$fromstringSender address as captured.
$tolist<string>Primary recipients, with empty entries dropped.
$subjectstringSubject line as captured.
$isSuccessfulboolWhether the mailer reported the message as sent.

Returns

self: Message carrying the envelope, without body, headers, or capture time.

public static function failedCount(list<self> $models): int

Counts the messages the mailer rejected.

Parameters

ParameterTypeDescription
$modelslist<self>Captured messages.

Returns

int: Number of messages reported as failed.

public static function fromArray(mixed $data, string $path): self

Narrows one persisted message of the mail payload into a typed entry.

Parameters

ParameterTypeDescription
$datamixedPersisted message, expected to be an object carrying the declared shape.
$pathstringJSON path of the message, used to report a malformed payload.

Returns

self: Message carrying every persisted field.

public static function fromCapture(array<array-key, mixed> $row): self

Narrows one captured EVENT_AFTER_SEND payload into a typed message.

Parameters

ParameterTypeDescription
$rowarray<array-key, mixed>Captured payload.

Returns

self: Message carrying every field the mailer exposed.

public function getBcc(): list<string>

Returns the blind carbon-copy recipients.

Returns

list<string>: Blind carbon-copy recipients in capture order.

public function getBody(): string

Returns the captured plain-text body.

Returns

string: Plain-text body, or '' when the message had none.

public function getCc(): list<string>

Returns the carbon-copy recipients.

Returns

list<string>: Carbon-copy recipients in capture order.

public function getCharset(): string

Returns the charset declared on the message.

Returns

string: Declared charset, or '' when none was set.

public function getFile(): string

Returns the path of the message the mailer persisted.

Returns

string: Path to the persisted .eml file, or '' when the mailer exposes none.

public function getFrom(): string

Returns the sender address as captured.

Returns

string: Sender address as captured.

public function getHeaders(): string

Returns the raw message headers as captured.

Returns

string: Raw RFC-5322 headers, joined with line breaks.

public function getReplyTo(): list<string>

Returns the reply-to addresses.

Returns

list<string>: Reply-to addresses in capture order.

public function getSubject(): string

Returns the subject line as captured.

Returns

string: Subject line as captured.

public function getTime(): int|null

Returns the capture timestamp.

Returns

int|null: Capture timestamp as a Unix-epoch second, or null when the payload carried no parseable time.

public function getTo(): list<string>

Returns the primary recipients.

Returns

list<string>: Primary recipients in capture order.

public function isSuccessful(): bool

Reports whether the mailer delivered the message.

Returns

bool: true when the mailer reported the message as sent.

public function jsonSerialize(): array<string, mixed>

Serializes the message into its persisted payload.

Returns

array<string, mixed>

public function withBcc(list<string> $bcc): self

Returns a copy with the blind carbon-copy recipients.

Parameters

ParameterTypeDescription
$bcclist<string>Recipients in capture order.

Returns

self: New instance carrying the requested recipients.

public function withBody(string $body): self

Returns a copy with the captured body.

Parameters

ParameterTypeDescription
$bodystringPlain-text body, or '' when the message had none.

Returns

self: New instance carrying the requested body.

public function withCc(list<string> $cc): self

Returns a copy with the carbon-copy recipients.

Parameters

ParameterTypeDescription
$cclist<string>Recipients in capture order.

Returns

self: New instance carrying the requested recipients.

public function withCharset(string $charset): self

Returns a copy with the declared charset.

Parameters

ParameterTypeDescription
$charsetstringCharset declared on the message, or '' when none was set.

Returns

self: New instance carrying the requested charset.

public function withFile(string $file): self

Returns a copy with the persisted message file.

Parameters

ParameterTypeDescription
$filestringPath to the .eml file, or '' when the mailer exposes none.

Returns

self: New instance carrying the requested file.

public function withHeaders(string $headers): self

Returns a copy with the raw message headers.

Parameters

ParameterTypeDescription
$headersstringRaw RFC-5322 headers, joined with line breaks.

Returns

self: New instance carrying the requested headers.

public function withReplyTo(list<string> $replyTo): self

Returns a copy with the reply-to addresses.

Parameters

ParameterTypeDescription
$replyTolist<string>Addresses in capture order.

Returns

self: New instance carrying the requested addresses.

public function withTime(int|null $time): self

Returns a copy with the capture timestamp.

Parameters

ParameterTypeDescription
$timeint|nullUnix-epoch second, or null when the payload carried no parseable time.

Returns

self: New instance carrying the requested timestamp.