this code is from php.net IMAP documentation user comments. credit goes to "y dot daradkeh at gmail dot com"
<?php
$mbox = imap_open("$imap_server".$f,$name,$pass);
// delibertely choose a message with an attachment
$info = imap_fetchstructure($mbox, $mno);
// find out how may parts the object has
$numparts = count($info->parts);
$i=0;
// find if multipart message
if ($numparts >1)
{
echo "<b>More than one part</b><br><br>";
foreach ($info->parts as $part)
{
if ($part->disposition == "INLINE")
printf("Inline message has %s lines<BR>", $part->lines);
elseif ($part->disposition == "attachment")
{
$i++;
echo $i." Attachment/s found!<br>";
echo "Filename: ".$part->dparameters[0]->value."<br><br>";
}
}
}
else
echo "Only one part";
imap_close($mbox);
?>
hopefully that can help you figure out how to get the attachments.