note 71775 added to function.imap-fetchbody

From: Date: Fri, 15 Dec 2006 04:38:08 +0000
Subject: note 71775 added to function.imap-fetchbody
Groups: php.notes 
Request: Send a blank email to php-notes+get-120625@lists.php.net to get a copy of this message
Musawir Ali comment is not totally correct, ifdisposition= 1 will never tell you 100% if there is an attachment. You must look at (ifdparameters, ifparameters) if (1) of them is greater then (0), then you need to look inside (parameters), looking at each ($obj->parameters) and check the (attribute) for (NAME, FILENAME), also be sure to set them to upper or lower case before doing your testing. That's the only way to know if you have an attachment. inline attachments will have $obj->ifid equal to 1, the $obj->id will contain the (cid). If $obj->ifid equals 0 then it's also an attachment (file type) if you have (NAME, FILENAME) as the current parameters (attribute). <?php $name = ''; if ( $parent->ifdparameters && sizeof ( $parent->dparameters ) > 0 ) { foreach ( $parent->dparameters as $child ) { if ( strtolower ( $child->attribute ) == 'name' || strtolower ( $child->attribute ) == 'filename' ) { $name = strtolower ( $child->value ); } } } if ( empty ( $name ) ) { if ( $parent->ifparameters && sizeof ( $parent->parameters ) > 0 ) { foreach ( $parent->parameters as $child ) { if ( strtolower ( $child->attribute ) == 'name' || strtolower ( $child->attribute ) == 'filename' ) { $name = strtolower ( $child->value ); } } } } ?> $parent is derived from imap_fetchstructure(), as a child object if $obj->parts is set or as the $parent if $obj->parts is not set! ---- Server IP: 64.71.164.2 Probable Submitter: 66.31.240.158 ---- Manual Page -- http://www.php.net/manual/en/function.imap-fetchbody.php Edit -- https://master.php.net/note/edit/71775 Del: integrated -- https://master.php.net/note/delete/71775/integrated Del: useless -- https://master.php.net/note/delete/71775/useless Del: bad code -- https://master.php.net/note/delete/71775/bad+code Del: spam -- https://master.php.net/note/delete/71775/spam Del: non-english -- https://master.php.net/note/delete/71775/non-english Del: in docs -- https://master.php.net/note/delete/71775/in+docs Del: other reasons-- https://master.php.net/note/delete/71775 Reject -- https://master.php.net/note/reject/71775 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120625) next »