problems in MimeDecode
| From: | Max Seegr�ber | Date: | Thu, 05 Jun 2003 19:49:14 +0000 |
| Subject: | problems in MimeDecode | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5834@lists.php.net to get a copy of this message | ||
Why dosn't this code work? It should show the Gif image inside this MIME
encoded E-Mail massage. I use an sampe code from:
http://www.evolt.org/article/Using_PEAR_s_mimeDecode_module/18/60103/?format
=print
thx for help
max
<?
include('Mail/mimeDecode.php');
$input = '
From: Gijs van Tulder <gvtulder@example.com>
To: thelist@lists.evolt.org
Subject: Decoding MIME mail
Date: Wed, 12 Mar 2003 10:26:59 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="MyBoundary"
This is a multi-part message in MIME format.
--MyBoundary
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hi, this is my message. See the attached image!
--MyBoundary
Content-Type: image/gif; name="myimage.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="myimage.gif"
R0lGODlhogBrAPcAAAAAAP///zwKC2UhIrdPUKU0OMmLjagEDJIEDZEmLduztW8HD64YJlUJEXkX
...omitted many lines like the above...
gahQUgx4n5kQWQQJ0sqEREAAADs=
--MyBoundary--
'
?>
<html>
<head>
<title>Unbenanntes Dokument</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<?
$params['include_bodies'] = true;
$params['decode_bodies'] = true;
$params['decode_headers'] = true;
$params['input'] = $input;
$structure = Mail_mimeDecode::decode($params);
print_r($structure);
$list = '';
foreach ($structure->parts as $part) {
// is this an image?
if ($part->ctype_primary=='image') {
$list .= $part->ctype_parameters['filename'].': '.
strlen($part->body)." bytes\n";
}
}
?>
</p>
<p><font size="2" face="Geneva, Arial, Helvetica, sans-serif">
</font></p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>