Re: problems in MimeDecode

From: Date: Wed, 11 Jun 2003 00:44:38 +0000
Subject: Re: problems in MimeDecode
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5902@lists.php.net to get a copy of this message
Max SeegräBer wrote:
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:
it should show that there is an attached image.. - I found that I was getting IMAGE in capitals, rather than image.. - have you compared the output of the print_r() to what is being tested. dont forget you need to base64decode the attachment to get the file. Regards Alan
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>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> </body> </html>


« previous php.pear.general (#5902) next »