Mail/Part.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Mail  
Version
$Id$  

\Zend_Mail_Part

Package: Zend_Mail
Implements
Children
\Zend_Mail_Message
\Zend_Mail_Part_File
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectednull|string $_content
raw part body
Details
Type
null | string
>VPropertyprotectednull|int $_countParts
count of parts of a multipart message
Details
Type
null | int
>VPropertyprotectednull|array $_headers
headers of part as array
Details
Type
null | array
>VPropertyprotectedint $_iterationPos = 1
current position of iterator
Default value1Details
Type
int
>VPropertyprotectednull|\Zend_Mail_Storage_Abstract $_mail
mail handler, if late fetch is active
Details
Type
null | \Zend_Mail_Storage_Abstract
>VPropertyprotectedint $_messageNum = 0
message number for mail handler
Default value0Details
Type
int
>VPropertyprotectedstring $_partClass
Class to use when creating message parts
Details
Type
string
>VPropertyprotectedarray $_parts = array()
parts of multipart message
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_topLines = ''
toplines as fetched with headers
Default value''Details
Type
string

Methods

methodpublic__construct(array $params) : void

Public constructor

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
NameTypeDescription
$paramsarray

full message with or without headers

Throws
ExceptionDescription
\Zend_Mail_Exception
methodpublic__get(string $name) : string

Getter for mail headers - name is matched in lowercase

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

header name

Returns
TypeDescription
stringvalue of header
Throws
ExceptionDescription
\Zend_Mail_Exception
Details
See
 
methodpublic__isset( $name) : boolean

Isset magic method proxy to hasHeader

This method is short syntax for Zend_Mail_Part::hasHeader($name);
Parameters
NameTypeDescription
$name
Returns
TypeDescription
boolean
Details
See
 
methodpublic__toString() : string

magic method to get content of part

Returns
TypeDescription
stringcontent
methodprotected_cacheContent() : null

Cache content and split in parts if multipart

Returns
TypeDescription
null
Throws
ExceptionDescription
\Zend_Mail_Exception
methodpubliccountParts() : int

Count parts of a multipart part

Returns
TypeDescription
intnumber of sub-parts
methodpubliccurrent() : \Zend_Mail_Part

implements Iterator::current()

Returns
TypeDescription
\Zend_Mail_Partcurrent part
methodpublicgetChildren() : \Zend_Mail_Part

implements RecursiveIterator::getChildren()

Returns
TypeDescription
\Zend_Mail_Partsame as self::current()
methodpublicgetContent() : string

Body of part

If part is multipart the raw content of this part with all sub parts is returned
Returns
TypeDescription
stringbody
Throws
ExceptionDescription
\Zend_Mail_Exception
methodpublicgetHeader(string $name, string $format = null) : string | array

Get a header in specificed 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::LINEEND as delim).
Parameters
NameTypeDescription
$namestring

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

$formatstring

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

Returns
TypeDescription
string | arrayvalue of header in wanted or internal format
Throws
ExceptionDescription
\Zend_Mail_Exception
methodpublicgetHeaderField(string $name, string $wantedPart = 0, string $firstName = 0) : string | array

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

name of header, like in getHeader()

$wantedPartstring

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

$firstNamestring

key name for the first part

Returns
TypeDescription
string | arraywanted part or all parts as array($firstName => firstPart, partname => value)
Throws
ExceptionDescription
\Zend_Exception,Zend_Mail_Exception
methodpublicgetHeaders() : array

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
TypeDescription
arrayheaders as array(name => value)
methodpublicgetPart(int $num) : \Zend_Mail_Part

Get part of multipart message

Parameters
NameTypeDescription
$numint

number of part starting with 1 for first part

Returns
TypeDescription
\Zend_Mail_Partwanted part
Throws
ExceptionDescription
\Zend_Mail_Exception
methodpublicgetPartClass() : string

Retrieve the class name used to encapsulate message parts

Returns
TypeDescription
string
methodpublicgetSize() : int

Return size of part

Quite simple implemented currently (not decoding). Handle with care.
Returns
TypeDescription
intsize
methodpublichasChildren() : bool

implements RecursiveIterator::hasChildren()

Returns
TypeDescription
boolcurrent element has children/is multipart
methodpublicheaderExists(string $name) : boolean

Check wheater the Mail part has a specific header.

Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
boolean
methodpublicisMultipart() : bool

Check if part is a multipart message

Returns
TypeDescription
boolif part is multipart
methodpublickey() : string

implements Iterator::key()

Returns
TypeDescription
stringkey/number of current part
methodpublicnext() : null

implements Iterator::next()

Returns
TypeDescription
null
methodpublicrewind() : null

implements Iterator::rewind()

Returns
TypeDescription
null
methodpublicsetPartClass(string $class) : \Zend_Mail_Part

Set name pf class used to encapsulate message parts

Parameters
NameTypeDescription
$classstring
Returns
TypeDescription
\Zend_Mail_Part
methodpublicvalid() : bool

implements Iterator::valid()

Returns
TypeDescription
boolcheck if there's a current element
Documentation was generated by phpDocumentor 2.2.0 .