ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     --TEST--
Check extract_part_file
--SKIPIF--
<?php
/* vim600: sw=4 ts=4 fdm=marker syn=php
*/
if (!extension_loaded("mailparse")) @dl("mailparse.so");
if (!extension_loaded("mailparse")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
if (!extension_loaded("mailparse")) @dl("mailparse.so");
$text = <<<EOD
To: fred@bloggs.com
Mime-Version: 1.0
Content-Type: text/plain
Subject: A simple MIME message

hello, this is some text hello.
blah blah blah.

EOD;

$fp = tmpfile();
fwrite($fp, $text);
rewind($fp);


$mime = mailparse_msg_create();
mailparse_msg_parse($mime, $text);

echo "Extract to output\n";
mailparse_msg_extract_part_file($mime, $fp);

echo "Extract and return as string\n";
$result = mailparse_msg_extract_part_file($mime, $fp, null);
echo "-->\n";
echo $result;

echo "\nExtract to open file\n";
$fpdest = tmpfile();
mailparse_msg_extract_part_file($mime, $fp, $fpdest);
echo "\nrewinding\n";
rewind($fpdest);
fpassthru($fpdest);

echo "\nExtract via user function\n";
$cbdata = "";
function callbackfunc($data) {
	$GLOBALS["cbdata"] .= $data;
}
mailparse_msg_extract_part_file($mime, $fp, "callbackfunc");
echo "callback data is:\n";
var_dump($cbdata);

echo "\nExtract via Closure\n";
$cbdata = "";
$callbackfunc = function ($data) {
	$GLOBALS["cbdata"] .= $data;
};
mailparse_msg_extract_part_file($mime, $fp, $callbackfunc);
echo "callback data is:\n";
var_dump($cbdata);

echo "\nExtract whole part to output\n";
mailparse_msg_extract_whole_part_file($mime, $fp);

echo "\nExtract part from string to output\n";
mailparse_msg_extract_part($mime, $text);
fclose($fpdest);
fclose($fp);

?>
--EXPECT--
Extract to output
hello, this is some text hello.
blah blah blah.
Extract and return as string
-->
hello, this is some text hello.
blah blah blah.

Extract to open file

rewinding
hello, this is some text hello.
blah blah blah.

Extract via user function
callback data is:
string(48) "hello, this is some text hello.
blah blah blah.
"

Extract via Closure
callback data is:
string(48) "hello, this is some text hello.
blah blah blah.
"

Extract whole part to output
To: fred@bloggs.com
Mime-Version: 1.0
Content-Type: text/plain
Subject: A simple MIME message

hello, this is some text hello.
blah blah blah.

Extract part from string to output
hello, this is some text hello.
blah blah blah.
