note 39420 added to function.imap-fetchstructure

From: Date: Wed, 28 Jan 2004 08:08:07 +0000
Subject: note 39420 added to function.imap-fetchstructure
Groups: php.notes 
Request: Send a blank email to php-notes+get-64295@lists.php.net to get a copy of this message
After many long hours of pouring over the object returned by imap_fetchstructure() I came up with the solution posted at the following url: http://p2p.wrox.com/topic.asp?TOPIC_ID=9063 The url above provides an example of how to access variables in the object returned by imap_fetchstructure(). This class creates an object with member variables containing the correct part numbers which are compatible with the imap_fetchbody() function. The structure returned looks something like this: 0 Raw Headers $this->pid[$mid][0] = 1 text/plain top level message $this->pid[$mid][1] = 2 message/rfc822 entire unparsed message multipart/mixed - part is skipped! 2.0 Raw Headers $this->pid[$mid][2] = 2.1 multipart/alternative contains unparsed contents of next subpart (text/plain && text/html) 2.1.0 Raw Headers $this->pid[$mid][3] = 2.1.1 text/plain 2nd level inline embedded message $this->pid[$mid][4] = 2.1.2 text/html $this->pid[$mid][5] = 2.2 message/rfc822 entire unparsed message multipart/mixed - part is skipped! 2.2.0 Raw Headers $this->pid[$mid][6] = 2.2.1 multipart/alternative $this->pid[$mid][7] = 2.2.1.1 text/plain 3rd level inline embedded message $this->pid[$mid][8] = 2.2.1.2 text/html $this->pid[$mid][9] = 2.2.2 image/jpeg $this->pid[$mid][10] = 2.2.3 image/jpeg $this->pid[$mid][11] = 2.2.4 image/jpeg $this->pid[$mid][12] = 2.2.5 image/gif Its important to note why multipart/related, multipart/mixed and certain multipart/alternative (if parent part is message/rfc822 && not multipart/mixed) parts are skipped, imap_fetchbody **does not** retreive a message part for these parts. Which isn't a bug, as I have read in other places, these parts exist for the purpose of designing the viewer portion of a mail application. Also, headers aren't assigned part numbers here because they are easy to pick out. : ) Rich ---- Manual Page -- http://www.php.net/manual/en/function.imap-fetchstructure.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39420 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39420&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39420&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64295) next »