function imap_show_attach() { $imap = new IMAP(); if ($imap->open('david.touzeau', '180872', '127.0.0.1', '143')) { $hash = $imap->_decode_msg($_GET["msgid"]); $filename = $_GET["ShowMessageAttachment"]; header("Content-type: " . $hash["attachment"][$filename]["type"]); header("Content-Disposition: attachment; filename=" . $filename); echo $hash["attachment"][$filename]["filedata"]; } }