body_att) > 0) { sort($mbox_body->body_att); while($view_temp = array_shift($mbox_body->body_att)) { if($view_temp["sect"] == $part) { if($view_temp["encode"] == "quoted-printable") $view_file = imap_qprint(imap_fetchbody($imap["conn"], $mmsg, $view_temp["sect"])); else if($view_temp["encode"] == "base64") $view_file = imap_base64(imap_fetchbody($imap["conn"], $mmsg, $view_temp["sect"])); else $view_file = imap_fetchbody($imap["conn"], $mmsg, $view_temp["sect"]); if(eregi("(MSIE 5.0|MSIE 5.1|MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)) { header("Content-type: application/octet-stream"); header("Content-Length: ".$view_temp["dize"]); $array = imap_mime_header_decode($view_temp["name"]); header("Content-Disposition: attachment; filename=".$array[0]->text); header("Content-Transfer-Encoding: binary"); header("Pragma: no-cache"); header("Expires: 0"); } else { header("Content-type: file/unknown"); header("Content-Length: ".$view_temp["dize"]); $array = imap_mime_header_decode($view_temp["name"]); header("Content-Disposition: attachment; filename=".$array[0]->text); header("Pragma: no-cache"); header("Expires: 0"); } echo($view_file); } } } ?>