<?php

include("global.inc.php");

header("Content-type: $type/$subtype");
header("Content-Disposition: attachment; filename=$name");

if($encoding == "base64")
{
    echo imap_base64(imap_fetchbody($mailbox, $msgnum, $part_no, FT_UID));
}
elseif($encoding == "qprint")
{
    echo my_qprint(imap_fetchbody($mailbox, $msgnum, $part_no, FT_UID));
}
else
{
    echo imap_fetchbody($mailbox, $msgnum, $part_no, FT_UID);
}

?>
