mimedecode issue - no body

From: Date: Sun, 23 Apr 2006 23:02:39 +0000
Subject: mimedecode issue - no body
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-23814@lists.php.net to get a copy of this message
hi all ok really annoying issue here i had this script working where it would take an attached image and process it (after being piped to by sendmail) using pear mail, mail_mimedecode running on php 5.0.4 fedora core 4 [php] function parse_email() { /** * $origDest - location to put the attached image * $finalDest - location to put the processed images * which are then moved by a cron job to the images directory */ $origDest = '/mail-handler/'; $finalDest = $origDest . '/processed/'; /** * Read the stdin - piped data from Sendmail * and add all the email data into a variable we can read later */ $fh_in = fopen("php://stdin", "r"); while (!feof($fh_in)) { $curr_line = fread($fh_in, 1024); $email .= $curr_line; } fclose($fh_in); /** * create a new mimeDecode object (provided by PEAR) * that we can use to grab the attachment from the email */ $message = new Mail_mimeDecode($email); $mailObj = $message->decode($params); $from = $mailObj->headers['from']; $params['include_bodies'] = true; $params['decode_bodies'] = true; $params['decode_headers'] = true; // Get and Save the Attachments $i = 0; foreach($mailObj->parts as $key => $val) { $intRand = mt_rand(100000, 999999); $tmpObj = $mailObj->parts[$key]; if (!empty($tmpObj->body)) { if ($tmpObj->ctype_primary == 'image' && $tmpObj->ctype_secondary == 'jpeg' && strlen($tmpObj->body) > 2000) { $filename = $tmpObj->ctype_parameters['name']; //processing code } } $i++; } $blah = print_r($mailObj, true); send_response('myemail', $from . "\r\n7***********************\r\n" . $blah); } [/php] this code was working yesterday, then today, while testing, it seems to have stopped working it gets all the filenames, etc, etc. fine but there is no $tmpObj->body (it is empty) i have had the script send the print_r result back to me and all the ctype properties are there, etc. but no body sample working response [php] stdClass Object ( [headers] => Array ( [content-type] => image/jpeg; name="ATT00154.jpg" [content-transfer-encoding] => base64 [content-id] => <23abc@pc27-000> ) [ctype_primary] => image [ctype_secondary] => jpeg [ctype_parameters] => Array ( [name] => ATT00154.jpg ) [body] => ÿØÿà // --> see the body above exists [/php] sample response from today, not working [php] stdClass Object ( [headers] => Array ( [content-type] => image/jpeg; name="ATT00154.jpg" [content-transfer-encoding] => base64 [content-id] => <ATT00154.jpg> [content-location] => ATT00154.jpg ) [ctype_primary] => image [ctype_secondary] => jpeg [ctype_parameters] => Array ( [name] => ATT00154.jpg ) ) // --> see no body property above ) [/php] when i have the raw email sent back to me, all the text and encoded image is there, etc. i am sending the same emails, from the same addresses using the same format (i've also tried sending the emails as plain text with attachments, html emails with embedded image, html, with attached image) does anyone know what the issue could be? i have run pear upgrade all, etc, etc. thanks dave

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