note 108014 deleted from function.imap-fetchstructure by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 17:58:03 +0000 |
| Subject: | note 108014 deleted from function.imap-fetchstructure by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187694@lists.php.net to get a copy of this message | ||
Note Submitter: gguurruu at gmail dot com
----
raulggonzalez function works very well.
Here's a little tweak to return the attachments array instead of a single boolean value.
function getAttachments($part){
$arr = array();
if (isset($part->parts)){
foreach ($part->parts as $partOfPart){
foreach(getAttachments($partOfPart) as $val){
$arr[] = $val;
}
}
}
else{
if (isset($part->disposition)&& $part->disposition ==
'attachment'){
$arr[] = $part->dparameters[0]->value;
}
}
return $arr;
}