sender[0]->mailbox) . "@". $obj->sender[0]->host; $head[0]->fromMail = $mail; $head[0]->fromHost = $obj->sender[0]->host; $head[0]->fromMailBox = $obj->sender[0]->mailbox; $head[0]->toMail = strtolower($obj->to[0]->mailbox) . "@". $obj->to[0]->host; $head[0]->toHost = $obj->to[0]->host; $head[0]->toMailBox = $obj->to[0]->mailbox; $structure = imap_fetchstructure($imap, $mailId, FT_UID); /* detect for file attachments and use a different body part if ther is one */ if($structure->subtype == "ALTERNATIVE" || $structure->subtype == "PLAIN"){ $body = imap_fetchbody($imap, $mailId, 1, FT_UID); }else if($structure->subtype == "MIXED"){ $body = imap_fetchbody($imap, $mailId, 1.1, FT_UID); } imap_delete($imap, $mailId, FT_UID); } } imap_expunge($imap); imap_close($imap); ?>