Smiling Souls

Steeped in the delicious tea like leaves of anthroposophy for the evolving soul.

Mail_IMAP::$msg

As the name implies, Mail_IMAP::$msg provides information about a message. The Mail_IMAP::$msg property is a multidimensional array in which the first level of nesting is offset by message id (the mid). In all there are four levels of nesting. There are three indices below the message id level of nesting, the pid, in and at arrays. The pid array contains the default part id for a message, this is the top-level message part that is displayed when you click on and open a message for the first time. This part id and the message id can be passed to Mail_IMAP::getBody() to retrieve the body of the default message part.

The in and at arrays contain information about the message attachments, these are created by calling Mail_IMAP::getParts(). If the $args['retrieve_all'] argument is passed to Mail_IMAP::getParts() and its value is TRUE all message parts are indexed in the in and at arrays, message parts with an inline disposition go into the in array, whereas message parts with an attachment disposition go into the at array. If $args['retrieve_all'] is FALSE, its default value, only message parts relevant to the part currently being displayed, i.e. its immediate children are retrieved and indexed in these arrays (similar to how MS Outlook handles messages).

Note: Calling on Mail_IMAP::getParts() with the $rtn argument true returns the contents of the Mail_IMAP::$msg property.

The in and at arrays themselves have a sublevel of nesting, which is outlined in the following table.

Associative Indice Data type Description
The in array
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 an inline message part.
fsize int The size in bytes of an inline message part.
fname str The original file name of an inline message part (if any).
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 an inline message part (if any is specified).
The at array
pid str The part id of an attachment. 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 an attachment.
fsize int The size in bytes of an attachment.
fname str The original file name of an attachment (if any).
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 an attachment (if any is specified).

Another level of nesting is present below each field name. This level of nesting is numbered offset, and though it is numbered offset the count is not precise, foreach should be used to maintain the proper indice association when looping through each array.

The above parameters are the ones Mail_IMAP looks for by default. If a parameter does not exist for a message part, no indice is created. Additionally, other parameters may be specifed in the Mail_IMAP::$fields property.

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.