Methods

Getter for mail headers - name is matched in lowercase

__get(string $name) : string

This getter is short for PartInterface::getHeader($name, 'string')

see \Zend\Mail\Storage\Part\PartInterface::getHeader()

Parameters

$name

string

header name

Exceptions

\Zend\Mail\Storage\Part\Exception\ExceptionInterface

Returns

stringvalue of header

magic method to get content of part

__toString() : string

Returns

stringcontent

Count parts of a multipart part

countParts() : int

Returns

intnumber of sub-parts

Body of part

getContent() : string

If part is multipart the raw content of this part with all sub parts is returned

Exceptions

\Zend\Mail\Storage\Part\Exception\ExceptionInterface

Returns

stringbody

Get a header in specified format

getHeader(string $name, string $format) : string | array | \Zend\Mail\Header\HeaderInterface | \ArrayIterator

Internally headers that occur more than once are saved as array, all other as string. If $format is set to string implode is used to concat the values (with Zend\Mime\Mime::LINEEND as delim).

Parameters

$name

string

name of header, matches case-insensitive, but camel-case is replaced with dashes

$format

string

change type of return value to 'string' or 'array'

Exceptions

\Zend\Mail\Storage\Part\Exception\ExceptionInterface

Returns

stringarray\Zend\Mail\Header\HeaderInterface\ArrayIteratorvalue of header in wanted or internal format

Get a specific field from a header like content type or all fields as array

getHeaderField(string $name, string $wantedPart, string $firstName) : string | array

If the header occurs more than once, only the value from the first header is returned.

Throws an exception if the requested header does not exist. If the specific header field does not exist, returns null.

Parameters

$name

string

name of header, like in getHeader()

$wantedPart

string

the wanted part, default is first, if null an array with all parts is returned

$firstName

string

key name for the first part

Exceptions

\Zend\Mail\Storage\Part\Exception\ExceptionInterface

Returns

stringarraywanted part or all parts as array($firstName => firstPart, partname => value)

Get all headers

getHeaders() : \Zend\Mail\Headers

The returned headers are as saved internally. All names are lowercased. The value is a string or an array if a header with the same name occurs more than once.

Returns

Get part of multipart message

getPart(int $num) : \Zend\Mail\Storage\Part\PartInterface

Parameters

$num

int

number of part starting with 1 for first part

Exceptions

\Zend\Mail\Storage\Part\Exception\ExceptionInterface

Returns

Return size of part

getSize() : int

Returns

intsize

Check if part is a multipart message

isMultipart() : bool

Returns

boolif part is multipart