package Default
inherited_from \Zend\Mail\Storage\Part

 Methods

Public constructor

__construct(array $params) 

This handler supports the following params:

  • file filename or open file handler with message content (required)
  • startPos start position of message or part in file (default: current position)
  • endPos end position of message or part in file (default: end of file)
  • EOL end of Line for messages
inherited_from \Zend\Mail\Storage\Part::__construct()

Parameters

$params

array

full message with or without headers

Exceptions

\Zend\Mail\Storage\Part\Exception\RuntimeException
\Zend\Mail\Storage\Part\Exception\InvalidArgumentException

Public constructor

__construct(array $params) 
Inherited

Part supports different sources for content. The possible params are:

  • handler an instance of AbstractStorage for late fetch
  • id number of message for handler
  • raw raw content with header and body as string
  • headers headers as array (name => value) or string, if a content part is found it's used as toplines
  • noToplines ignore content found after headers in param 'headers'
  • content content as string
  • strict strictly parse raw content

Parameters

$params

array

full message with or without headers

Exceptions

\Zend\Mail\Storage\Exception\InvalidArgumentException

Getter for mail headers - name is matched in lowercase

__get(string $name) : string
Inherited

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

see
inherited_from \Zend\Mail\Storage\Part\PartInterface::__get()

Parameters

$name

string

header name

Exceptions

\Zend\Mail\Storage\Exception\ExceptionInterface

Returns

stringvalue of header

Isset magic method proxy to hasHeader

__isset($name) : boolean
Inherited

This method is short syntax for Part::hasHeader($name);

see

Parameters

$name

Returns

boolean

magic method to get content of part

__toString() : string
Inherited
inherited_from \Zend\Mail\Storage\Part\PartInterface::__toString()

Returns

stringcontent

Count parts of a multipart part

countParts() : integer
Inherited
inherited_from \Zend\Mail\Storage\Part\PartInterface::countParts()

Returns

integernumber of sub-parts

implements Iterator::current()

current() : \Zend\Mail\Storage\Part
Inherited

Returns

\Zend\Mail\Storage\Partcurrent part

implements RecursiveIterator::getChildren()

getChildren() : \Zend\Mail\Storage\Part
Inherited

Returns

\Zend\Mail\Storage\Partsame as self::current()

Body of part

getContent(resource $stream = null) : string

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

inherited_from \Zend\Mail\Storage\Part::getContent()

Parameters

$stream

resource

Optional

Returns

stringbody

Body of part

getContent() : string
Inherited

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

inherited_from \Zend\Mail\Storage\Part\PartInterface::getContent()

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

stringbody

Get a header in specified format

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

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 Mime::LINEEND as delim).

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

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\Exception\InvalidArgumentException

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 = '0', string $firstName = '0') : string | array
Inherited

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.

inherited_from \Zend\Mail\Storage\Part\PartInterface::getHeaderField()

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\Mime\Exception\RuntimeException

Returns

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

Access headers collection

getHeaders() : \Zend\Mail\Headers
Inherited

Lazy-loads if not already attached.

inherited_from \Zend\Mail\Storage\Part\PartInterface::getHeaders()

Returns

\Zend\Mail\Headers

Get part of multipart message

getPart(integer $num) : \Zend\Mail\Storage\Part
inherited_from \Zend\Mail\Storage\Part::getPart()

Parameters

$num

integer

number of part starting with 1 for first part

Exceptions

\Zend\Mail\Storage\Part\Exception\RuntimeException

Returns

\Zend\Mail\Storage\Partwanted part

Get part of multipart message

getPart(integer $num) : \Zend\Mail\Storage\Part
Inherited
inherited_from \Zend\Mail\Storage\Part\PartInterface::getPart()

Parameters

$num

integer

number of part starting with 1 for first part

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

\Zend\Mail\Storage\Partwanted part

Return size of part

getSize() : integer

Quite simple implemented currently (not decoding). Handle with care.

inherited_from \Zend\Mail\Storage\Part::getSize()

Returns

integersize

Return size of part

getSize() : integer
Inherited

Quite simple implemented currently (not decoding). Handle with care.

inherited_from \Zend\Mail\Storage\Part\PartInterface::getSize()

Returns

integersize

implements RecursiveIterator::hasChildren()

hasChildren() : boolean
Inherited

Returns

booleancurrent element has children/is multipart

Check if part is a multipart message

isMultipart() : boolean
Inherited
inherited_from \Zend\Mail\Storage\Part\PartInterface::isMultipart()

Returns

booleanif part is multipart

implements Iterator::key()

key() : string
Inherited

Returns

stringkey/number of current part

implements Iterator::next()

next() 
Inherited

implements Iterator::rewind()

rewind() 
Inherited

implements Iterator::valid()

valid() : boolean
Inherited

Returns

booleancheck if there's a current element

Cache content and split in parts if multipart

_cacheContent() : null
Inherited

Exceptions

\Zend\Mail\Storage\Exception\RuntimeException

Returns

null

 Properties

 

raw part body

$content : null | string

Default

 

$contentPos

$contentPos 

Default

array()
 

count of parts of a multipart message

$countParts : null | integer

Default

 

$fh

$fh 

Default

 

Headers of the part

$headers : \Zend\Mail\Headers | null

Default

 

current position of iterator

$iterationPos : integer

Default

1
 

mail handler, if late fetch is active

$mail : null | \Zend\Mail\Storage\AbstractStorage

Default

 

message number for mail handler

$messageNum : integer

Default

0
 

$partPos

$partPos 

Default

array()
 

parts of multipart message

$parts : array

Default

array()
 

toplines as fetched with headers

$topLines : string

Default

''