note 43349 deleted from function.imap-bodystruct by didou
| From: | didou@php.net | Date: | Mon, 15 Jan 2007 00:36:14 +0000 |
| Subject: | note 43349 deleted from function.imap-bodystruct by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121697@lists.php.net to get a copy of this message | ||
Note Submitter: giraldo at nitrogendesign dot com
----
Here is a great snippet of code from our php email application (www.nitrogenlabs.com). This function
will give you the filenames of each attachment even if the attachment is in the first part of the
body...
<?php
function getAttachments($mbox,$msgNum){
$structure = imap_fetchstructure($mbox,$msgNum);
$contentParts = count($structure->parts);
if($contentParts > 1){
for($i=1; $i<=$contentParts; $i++){
if($structure->parts[$i]->type > 0){
$attachments .= $structure->parts[$i]->description;
}
}
}
return $attachments;
}
}
return $attachments;
}
?>