Re: Mail decoding and reading

From: Date: Wed, 28 Jun 2000 19:22:03 +0000
Subject: Re: Mail decoding and reading
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-3645@lists.php.net to get a copy of this message
----- Original Message ----- From: Bojan Gajic <bojan@inet.co.yu> To: Martin Prasek <webpropag@webpropag.cz> Cc: <php-general@lists.php.net> Sent: Wednesday, June 28, 2000 12:43 PM Subject: Re: [PHP] Mail decoding and reading > > > Martin Prasek wrote: > > > I have a MIME encapsulated message in the mailbox and I need to fech some > > information about it. > > I try to use something like: > > > > $Message_structure=IMAP_FetchStructure($stream,$nr); > > > > because MIME mesages are recurent, I can fetch information about subparts > > using something like this: > > > > $Structure_of_subpart= $Message_structure->parts[$i]; where $i = is the n > > umer of subpart, that I want to examine. > > > > And then I can fetch the appropriate message body like this: > > $body=IMAP_FetchBody($stream,$nr,$part) ; where $part si something like "1 > > .2.1" ...(Part 1,subpart 2 ... etc) > > > > It is OK > > > > But. > > > > I need to get the header Content-type: for the $part of the message, bec > > ause this header often contain a NAME of the file,like > > Content-type: image/jpeg;name=baby.jpg > > You can get numeric values for Content-type (type parameter) and encoding > (encoding parameter)... > eg. multipart is 1, aplication 3, img 5, base64 is 3... > > > > > > > > > it is important to have a right name for saving this part of the message to > > disk.I try to use $tructure_of_subpart->type , but id do not work. > > filename and name should be under dparameters and parameters... > > Should be. but i try the followig code for examining the $structure: if ($structure->ifparams) { for($i;$i<Count($structure->parameters));$i++) { echo $structure->parameters[$i]; } } Or because a ifind somewhere that $structure->parameters is the array of objects that have properties ->attribute and ->value, I try to do like this: if ($structure->ifparams) { $field=$structure->parameters; for($i;$i<Count($field));$i++) { $object = field[$i]; echo $object->attribute; echo $object->value; } } Both examples do not work. Do you have some example code how to do it in the right way ? Martin Prasek.

« previous php.general (#3645) next »