Interface PartInterface

Summary

Fully Qualified Name: Zend\Mail\Storage\Part\PartInterface
Extends: RecursiveIterator

Description

Methods

Name Description Defined By
__get() Getter for mail headers - name is matched in lowercase PartInterface
__toString() magic method to get content of part PartInterface
countParts() Count parts of a multipart part PartInterface
getContent() Body of part PartInterface
getHeader() Get a header in specified format PartInterface
getHeaderField() Get a specific field from a header like content type or all fields as array PartInterface
getHeaders() Get all headers PartInterface
getPart() Get part of multipart message PartInterface
getSize() Return size of part PartInterface
isMultipart() Check if part is a multipart message PartInterface

Method Details

__get()

Getter for mail headers - name is matched in lowercase

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

Parameter Name Type Description
$name string header

Returns: string value of header

__toString()

magic method to get content of part

Returns: string content

countParts()

Count parts of a multipart part

Returns: int number of sub-parts

getContent()

Body of part

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

Returns: string body

getHeader()

Get a header in specified format

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).

Parameter Name Type Description
$name string name
$format string change

Returns: string|array|\HeaderInterface|\ArrayIterator value of header in wanted or internal format

getHeaderField()

Get a specific field from a header like content type or all fields as 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.

Parameter Name Type Description
$name string name
$wantedPart string the
$firstName string key

Returns: string|array wanted part or all parts as [$firstName => firstPart, partname => value]

getHeaders()

Get all 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: \Headers

getPart()

Get part of multipart message

Parameter Name Type Description
$num int number

Returns: \PartInterface wanted part

getSize()

Return size of part

Returns: int size

isMultipart()

Check if part is a multipart message

Returns: bool if part is multipart

Top