mini\Mail\Mailbox
class
Documentation
Mailbox - RFC 5322 email address with optional display name
Represents a mailbox which is a display name + addr-spec combination. Immutable value object with validation.
Usage:
// Simple email
$mailbox = new Mailbox('frode@ennerd.com');
// With display name
$mailbox = new Mailbox('frode@ennerd.com', 'Frode Børli');
// Parse from string
$mailbox = Mailbox::fromString('Frode Børli <frode@ennerd.com>');
$mailbox = Mailbox::fromString('frode@ennerd.com');
// Modify (immutable)
$mailbox = $mailbox->withDisplayName('New Name');
// Use in string context
echo $mailbox; // "Frode Børli <frode@ennerd.com>"
Inheritance
Implements:
mini\Mail\MailboxInterface
Stringable
Properties (2)
private
string $addrSpec
private
?
string $displayName
Methods (8)
Create a mailbox
Parse a mailbox from a string
Validate an addr-spec (email address)
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}