note 43349 modified in function.imap-bodystruct by didou

From: Date: Tue, 31 Aug 2004 00:59:31 +0000
Subject: note 43349 modified in function.imap-bodystruct by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75698@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... <?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; } ?> --was-- 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; } http://php.net/manual/en/function.imap-bodystruct.php

« previous php.notes (#75698) next »