category Zend
package Zend_Mail
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Mail_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)
inherited_from \Zend_Mail_Part::__construct()

Parameters

$params

array

full message with or without headers

Exceptions

\Zend_Mail_Exception

Public constructor

__construct(array $params) 
Inherited

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

  • handler a instance of Zend_Mail_Storage_Abstract 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

Parameters

$params

array

full message with or without headers

Exceptions

\Zend_Mail_Exception

Getter for mail headers - name is matched in lowercase

__get(string $name) : string
Inherited

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

see
inherited_from \Zend_Mail_Part_Interface::__get()

Parameters

$name

string

header name

Exceptions

\Zend_Mail_Exception

Returns

stringvalue of header

Isset magic method proxy to hasHeader

__isset($name) : boolean
Inherited

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

see

Parameters

$name

Returns

boolean

magic method to get content of part

__toString() : string
Inherited
inherited_from \Zend_Mail_Part_Interface::__toString()

Returns

stringcontent

Count parts of a multipart part

countParts() : integer
Inherited
inherited_from \Zend_Mail_Part_Interface::countParts()

Returns

integernumber of sub-parts

implements Iterator::current()

current() : \Zend_Mail_Part
Inherited

Returns

\Zend_Mail_Partcurrent part

implements RecursiveIterator::getChildren()

getChildren() : \Zend_Mail_Part
Inherited

Returns

\Zend_Mail_Partsame as self::current()

Body of part

getContent($stream = null) : string

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

inherited_from \Zend_Mail_Part::getContent()

Parameters

$stream

Exceptions

\Zend_Mail_Exception

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_Part_Interface::getContent()

Exceptions

\Zend_Mail_Exception

Returns

stringbody

Get a header in specificed format

getHeader(string $name, string $format = null) : string | array
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 Zend_Mime::LINEEND as delim).

inherited_from \Zend_Mail_Part_Interface::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_Exception

Returns

stringarrayvalue 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 a Zend_Mail_Exception if the requested header does not exist. If the specific header field does not exist, returns null.

inherited_from \Zend_Mail_Part_Interface::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_Exception, Zend_Mail_Exception

Returns

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

Get all headers

getHeaders() : array
Inherited

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.

inherited_from \Zend_Mail_Part_Interface::getHeaders()

Returns

arrayheaders as array(name => value)

Get part of multipart message

getPart(integer $num) : \Zend_Mail_Part
inherited_from \Zend_Mail_Part::getPart()

Parameters

$num

integer

number of part starting with 1 for first part

Exceptions

\Zend_Mail_Exception

Returns

\Zend_Mail_Partwanted part

Get part of multipart message

getPart(integer $num) : \Zend_Mail_Part
Inherited
inherited_from \Zend_Mail_Part_Interface::getPart()

Parameters

$num

integer

number of part starting with 1 for first part

Exceptions

\Zend_Mail_Exception

Returns

\Zend_Mail_Partwanted part

Retrieve the class name used to encapsulate message parts

getPartClass() : string
Inherited

Returns

string

Return size of part

getSize() : integer

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

inherited_from \Zend_Mail_Part::getSize()

Returns

integersize

Return size of part

getSize() : integer
Inherited

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

inherited_from \Zend_Mail_Part_Interface::getSize()

Returns

integersize

implements RecursiveIterator::hasChildren()

hasChildren() : boolean
Inherited

Returns

booleancurrent element has children/is multipart

Check wheater the Mail part has a specific header.

headerExists(string $name) : boolean
Inherited

Parameters

$name

string

Returns

boolean

Check if part is a multipart message

isMultipart() : boolean
Inherited
inherited_from \Zend_Mail_Part_Interface::isMultipart()

Returns

booleanif part is multipart

implements Iterator::key()

key() : string
Inherited

Returns

stringkey/number of current part

implements Iterator::next()

next() : null
Inherited

Returns

null

implements Iterator::rewind()

rewind() : null
Inherited

Returns

null

Set name pf class used to encapsulate message parts

setPartClass(string $class) : \Zend_Mail_Part
Inherited

Parameters

$class

string

Returns

\Zend_Mail_Part

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_Exception

Returns

null

Ensure headers do not contain invalid characters

_validateHeaders(array $headers, boolean $assertNames = true
Inherited

Parameters

$headers

array

$assertNames

boolean

 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 part as array

$_headers : null | array

Default

 

current position of iterator

$_iterationPos : integer

Default

1
 

mail handler, if late fetch is active

$_mail : null | \Zend_Mail_Storage_Abstract

Default

 

message number for mail handler

$_messageNum : integer

Default

0
 

Class to use when creating message parts

$_partClass : string

Default

 

$_partPos

$_partPos 

Default

array()
 

parts of multipart message

$_parts : array

Default

array()
 

toplines as fetched with headers

$_topLines : string

Default

''