Open($object)){ $path = $account->GetProperty('u_fullmailboxpath'); }else{ $domain = substr($object,strrpos($object,'@')+1); } @$dir = opendir($path.'~spam/~quarantine/'.$qfolder.'/'); while ((@$file = readdir($dir)) !== false) { @$info = pathinfo($file); if($info['extension']=='tmp' || $info['extension']=='imap') break; } @closedir($dir); $id = $file; break; } $file = getfullpath($path,$u_spamfolder,$u_spamfoldervalue) . basename($id); header('Content-Type: text/plain'); header('Content-Disposition: filename="' . basename($id) . '"'); echo file_get_contents($file); ?>