Mail/Part.php
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Mail
- Version
- $Id: Part.php 24759 2012-05-05 02:58:55Z adamlundrigan $
\Zend_Mail_Part
- Implements
- \Zend_Mail_Part_Interface
- Children
- \Zend_Mail_Message
- \Zend_Mail_Part_File
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

null|\Zend_Mail_Storage_Abstract $_mail- Type
- null | \Zend_Mail_Storage_Abstract
Methods

__construct(array $params) : voidPublic 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
| Name | Type | Description |
|---|---|---|
| $params | array | full message with or without headers |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

__get(string $name) : stringGetter for mail headers - name is matched in lowercase
This getter is short for Zend_Mail_Part::getHeader($name, 'string')
| Name | Type | Description |
|---|---|---|
| $name | string | header name |
| Type | Description |
|---|---|
| string | value of header |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

__isset(string $name) : booleanIsset magic method proxy to hasHeader
This method is short syntax for Zend_Mail_Part::hasHeader($name);
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

_cacheContent() : nullCache content and split in parts if multipart
| Type | Description |
|---|---|
| null |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

current() : \Zend_Mail_Partimplements Iterator::current()
| Type | Description |
|---|---|
| \Zend_Mail_Part | current part |

getChildren() : \Zend_Mail_Partimplements RecursiveIterator::getChildren()
| Type | Description |
|---|---|
| \Zend_Mail_Part | same as self::current() |

getContent() : stringBody of part
If part is multipart the raw content of this part with all sub parts is returned
| Type | Description |
|---|---|
| string | body |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

getHeader(string $name, string $format = null) : string | arrayGet 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).
| Name | Type | Description |
|---|---|---|
| $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' |
| Type | Description |
|---|---|
| string | array | value of header in wanted or internal format |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

getHeaderField(string $name, string $wantedPart = 0, string $firstName = 0) : string | arrayGet 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.
| Name | Type | Description |
|---|---|---|
| $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 |
| Type | Description |
|---|---|
| string | array | wanted part or all parts as array($firstName => firstPart, partname => value) |
| Exception | Description |
|---|---|
| \Zend_Exception, | Zend_Mail_Exception |

getHeaders() : arrayGet 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.
| Type | Description |
|---|---|
| array | headers as array(name => value) |

getPart(int $num) : \Zend_Mail_PartGet part of multipart message
| Name | Type | Description |
|---|---|---|
| $num | int | number of part starting with 1 for first part |
| Type | Description |
|---|---|
| \Zend_Mail_Part | wanted part |
| Exception | Description |
|---|---|
| \Zend_Mail_Exception |

getPartClass() : stringRetrieve the class name used to encapsulate message parts
| Type | Description |
|---|---|
| string |

getSize() : intReturn size of part
Quite simple implemented currently (not decoding). Handle with care.
| Type | Description |
|---|---|
| int | size |

hasChildren() : boolimplements RecursiveIterator::hasChildren()
| Type | Description |
|---|---|
| bool | current element has children/is multipart |

headerExists(string $name) : booleanCheck wheater the Mail part has a specific header.
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

isMultipart() : boolCheck if part is a multipart message
| Type | Description |
|---|---|
| bool | if part is multipart |

setPartClass(string $class) : \Zend_Mail_PartSet name pf class used to encapsulate message parts
| Name | Type | Description |
|---|---|---|
| $class | string |
| Type | Description |
|---|---|
| \Zend_Mail_Part |