note 43349 added to function.imap-bodystruct
| From: | giraldo at nitrogendesign dot com | Date: | Fri, 18 Jun 2004 07:59:34 +0000 |
| Subject: | note 43349 added to function.imap-bodystruct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71282@lists.php.net to get a copy of this message | ||
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...
function getAttachments($mbox,$msgNum){
$structure = imap_fetchstructure($mbox,$msgNum);
$contentParts = count($structure->parts);
if($contentParts > 1){
for($i=1; $i<=$contentParts; $i++){
//$structure->parts[1]->type;
//$fileType[$i] = imap_fetchstructure($mbox,$msgNum,$i);
if($structure->parts[1]->type > 0){
$attachments = $structure->parts[1]->description;
}
}
}
return $attachments;
}
----
Manual Page -- http://www.php.net/manual/en/function.imap-bodystruct.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43349
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43349&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43349&report=yes
Search -- http://master.php.net/manage/user-notes.php