/** * @param resource $filePointer A valid file pointer. * * @return array Returns an array of associative arrays listing filename information. * - filename => Path to the temporary file name created * - origfilename => The original filename, for uuencoded parts only * The first filename entry is the message body. The next entries are the decoded uuencoded files. */ public static function uudecodeAll($filePointer) { return mailparse_uudecode_all($filePointer); }
<?php $f = fopen('/etc/passwd', 'r'); fclose($f); var_dump(mailparse_uudecode_all($f)); var_dump(mailparse_determine_best_xfer_encoding($f)); var_dump(mailparse_stream_encode($f, $f, 'utf8'));
$data = fread($dest, 2048); VS($data, "hello, this is some text=3Dhello."); $text = "To: fred@bloggs.com\n" . "\n" . "blah blah blah From blah \$ \" & £ blah blah blah blah blah\n" . "From the first of the month, things will be different!\n" . "blah blah blah From blah\n" . "Frome is a town in Somerset."; ob_start(); $fp = tmpfile(); fwrite($fp, $text); rewind($fp); $fpdest = tmpfile(); mailparse_stream_encode($fp, $fpdest, "quoted-printable"); rewind($fpdest); fpassthru($fpdest); fclose($fp); fclose($fpdest); $output = ob_get_contents(); ob_end_clean(); VS($output, "To: fred@bloggs.com\r\n" . "\r\n" . "blah blah blah From blah \$ \" & =C2=A3 blah blah blah blah blah\r\n" . "=46rom the first of the month, things will be different!\r\n" . "blah blah blah From blah\r\n" . "Frome is a town in Somerset."); ////////////////////////////////////////////////////////////////////// $text = "To: fred@bloggs.com\n" . "\n" . "hello, this is some text hello.\n" . "blah blah blah.\n" . "\n" . "begin 644 test.txt\n" . "/=&AI<R!I<R!A('1E<W0*\n" . "`\n" . "end"; ob_start(); $fp = tmpfile(); fwrite($fp, $text); $data = mailparse_uudecode_all($fp); echo "BODY\n"; readfile($data[0]['filename']); echo "UUE\n"; readfile($data[1]['filename']); unlink($data[0]['filename']); unlink($data[1]['filename']); $output = ob_get_contents(); ob_end_clean(); VS($output, "BODY\n" . "To: fred@bloggs.com\n" . "\n" . "hello, this is some text hello.\n" . "blah blah blah.\n" . "\n" . "UUE\n" . "this is a test\n");