Richard York

Web Developer, Author, and Artist

Mail_IMAP::$structure

The Mail_IMAP::$structure property contains raw information about the structure of each message and is created in Mail_IMAP::_declareParts(). This property is used internally by Mail_IMAP but is provided as a public property for convienience. It is unlikely that a typical project would have any need of accessing the information in it directly.

The information in Mail_IMAP::$structure is used by other Mail_IMAP methods that...

  • separate inline parts from attachments
  • determine which message part is the default part
  • decide which message body to display and overall plays an important role in many other aspects of Mail_IMAP

Warning: This property should be used READ ONLY (if used at all). Since this property is fundamental to the functionality that Mail_IMAP provides, altering the contents of this property could have an adverse impact on Mail_IMAP"s ability to parse the contents of a message.

The content of the Mail_IMAP::$structure property is layered in a multidimensional array. The first layer of nesting is structured in indices offset by the message number (the mid). The second layer is structured in the associative indices outlined below.

Associative Indice Data type Description
obj object The object returned by imap_fetchstructure().
pid str The part id of a message part. The part id is concatenated as a series of numbers each separated by a period which allows a message part's nesting to be given a location within a multipart message.
ftype str The MIME type of a message part.
fsize int The size in bytes of a message part.
fname str The original file name of a message part (if any).
encoding str The type of encoding used on a message part, such as base64, binary, quoted-printable, etc. The Mail_IMAP::$_encodingTypes property determines the available encoding types.
disposition str One of inline or attachment. If no disposition is specified, Mail_IMAP always defaults to inline.
cid str If a part is related to another, as in the case of multipart/related messages where images, sounds, frames and other types of files can be directly embedded in an HTML message. Each embedded part is referenced in the HTML document in "src" attributes like any other file but instead of a file path a unique id appears. This unique id is included in the message headers with each embedded part, which are included in the message as inline attachments. If such an id is present Mail_IMAP stores the id in the cid indice where by using the Mail_IMAP::getRelatedParts() method those ids can be found and replaced in the HTML source with a file path to a script which can display the part.
has_at bool Messages can have attachments and can be attachments of other messages and so on, has_at is TRUE if a message part contains other attachments and is FALSE otherwise.
charset str Contains the character set of the message part (if any is specified).

One more level of nesting is present beyond each field name. This level of nesting is offset based on the value of a counter running in Mail_IMAP::_declareParts() that increments for each message part. The numbering is not precise due to a minor bug in the counter, meaning between certain levels of nesting there may be a gap in numbering. Use foreach instead of a counter to ensure proper numbering is maintained.

Additionally, other parameters may or may not be present, depending on the parameters contained in a message.

Comments

There are no comments posted at this time.

Leave a Comment

Simple HTML is allowed: <code>, <b>, <i>, <u>, <var>, <strong>, <em>, <blockquote>, <ul>, <ol>, <li>, <p> (no attributes). All spacing and line breaks in your comment will be preserved.

* All comments are moderated and are subject to approval.
Your comment will appear once it has been approved.
Posting multiple times will not expedite the approval process.

Comments are closed at this time.

© Copyright 2014 Hot Toddy, All Rights Reserved.