MailMimeParser 2.2

AddressHeader extends AbstractHeader
in package

A header containing one or more email addresses and/or groups of addresses.

An address is separated by a comma, and each group separated by a semi-colon. The AddressHeader provides a complete list of all addresses referenced in a header including any addresses in groups, in addition to being able to access the groups separately if needed.

For full specifications, see

Tags
author

Zaahid Bateson

Table of Contents

$addresses  : array<string|int, AddressPart>
$groups  : array<string|int, AddressGroupPart>
$name  : string
$parts  : array<string|int, IHeaderPart>
$rawValue  : string
__construct()  : mixed
Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.
__toString()  : string
Returns the string representation of the header.
getAddresses()  : array<string|int, AddressPart>
Returns all address parts in the header including any addresses that are in groups (lists).
getEmail()  : string
Returns the first email address in the header.
getGroups()  : array<string|int, AddressGroupPart>
Returns all group parts (lists) in the header.
getName()  : string
Returns the name of the header.
getParts()  : array<string|int, IHeaderPart>
Returns an array of IHeaderPart objects the header's value has been parsed into.
getPersonName()  : string|null
Returns the name associated with the first email address to complement getValue()/getEmail() if one is set, or null if not.
getRawValue()  : string
Returns the raw value of the header.
getValue()  : string
Returns the parsed 'value' of the header.
hasAddress()  : bool
Returns true if an address exists with the passed email address.
getConsumer()  : AbstractConsumer
Returns an AddressBaseConsumer.
setParseHeaderValue()  : mixed
Overridden to extract all addresses into addresses array.

Properties

$addresses

protected array<string|int, AddressPart> $addresses = []

array of addresses, included all addresses contained in groups.

Methods

__construct()

Assigns the header's name and raw value, then calls getConsumer and setParseHeaderValue to extract a parsed value.

public __construct(ConsumerService $consumerService, string $name, string $value) : mixed
Parameters
$consumerService : ConsumerService

For parsing the value.

$name : string

Name of the header.

$value : string

Value of the header.

Return values
mixed

__toString()

Returns the string representation of the header.

public __toString() : string

i.e.: ': '

Return values
string

The string representation.

getAddresses()

Returns all address parts in the header including any addresses that are in groups (lists).

public getAddresses() : array<string|int, AddressPart>
Return values
array<string|int, AddressPart>

The addresses.

getEmail()

Returns the first email address in the header.

public getEmail() : string
Return values
string

The email address

getName()

Returns the name of the header.

public getName() : string
Return values
string

The name.

getParts()

Returns an array of IHeaderPart objects the header's value has been parsed into.

public getParts() : array<string|int, IHeaderPart>
Return values
array<string|int, IHeaderPart>

The array of parts.

getPersonName()

Returns the name associated with the first email address to complement getValue()/getEmail() if one is set, or null if not.

public getPersonName() : string|null
Return values
string|null

The person name.

getRawValue()

Returns the raw value of the header.

public getRawValue() : string
Return values
string

The raw value.

getValue()

Returns the parsed 'value' of the header.

public getValue() : string

For headers that contain multiple parts, like address headers (To, From) or parameter headers (Content-Type), the 'value' is the value of the first parsed part.

Return values
string

The value

hasAddress()

Returns true if an address exists with the passed email address.

public hasAddress(string $email) : bool

Comparison is done case insensitively.

Parameters
$email : string
Return values
bool

Search results