1828. Class

1828.1. Zend\Mail\Storage\Part

1828.1.1. Methods

1828.1.1.1. __construct

__construct()

Public constructor

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:array – full message with or without headers
Throws ExceptionInvalidArgumentException:
 

1828.1.1.2. isMultipart

isMultipart()

Check if part is a multipart message

Return type:bool if part is multipart

1828.1.1.3. getContent

getContent()

Body of part

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

Return type:string body

1828.1.1.4. getSize

getSize()

Return size of part

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

Return type:int size

1828.1.1.5. _cacheContent

_cacheContent()

Cache content and split in parts if multipart

Return type:null

1828.1.1.6. getPart

getPart()

Get part of multipart message

Parameters:int – number of part starting with 1 for first part
Throws ExceptionRuntimeException:
 
Return type:Part wanted part

1828.1.1.7. countParts

countParts()

Count parts of a multipart part

Return type:int number of sub-parts

1828.1.1.8. getHeaders

getHeaders()

Access headers collection

Lazy-loads if not already attached.

Return type:Headers

1828.1.1.9. getHeader

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

Parameters:
  • string – name of header, matches case-insensitive, but camel-case is replaced with dashes
  • string – change type of return value to ‘string’ or ‘array’
Throws ExceptionInvalidArgumentException:
 
Return type:

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

1828.1.1.10. getHeaderField

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.

Parameters:
  • string – name of header, like in getHeader()
  • string – the wanted part, default is first, if null an array with all parts is returned
  • string – key name for the first part
Return type:

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

Throws :

ZendMimeExceptionRuntimeException

1828.1.1.11. __get

__get()

Getter for mail headers - name is matched in lowercase

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

Parameters:string – header name
Return type:string value of header
Throws :ExceptionExceptionInterface

1828.1.1.12. __isset

__isset()

Isset magic method proxy to hasHeader

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

Parameters:string
Return type:bool

1828.1.1.13. __toString

__toString()

magic method to get content of part

Return type:string content

1828.1.1.14. hasChildren

hasChildren()

implements RecursiveIterator::hasChildren()

Return type:bool current element has children/is multipart

1828.1.1.15. getChildren

getChildren()

implements RecursiveIterator::getChildren()

Return type:Part same as self::current()

1828.1.1.16. valid

valid()

implements Iterator::valid()

Return type:bool check if there’s a current element

1828.1.1.18. key

key()

implements Iterator::key()

Return type:string key/number of current part

1828.1.1.19. current

current()

implements Iterator::current()

Return type:Part current part

1828.1.1.20. rewind

rewind()

implements Iterator::rewind()