I was wondering if anyone knew how you can get a attachment from an e-mail through imap, in php?
I found a function that gets all parts of an e-mail (except for the attachment's data), including the file name of the attachment and puts it into an array:
Code: Select all
<?
function retrieve_message($mbox, $messageid)
{
$message = array();
$header = imap_header($mbox, $messageid);
$structure = imap_fetchstructure($mbox, $messageid);
$message['subject'] = $header->subject;
$message['fromaddress'] = $header->fromaddress;
$message['toaddress'] = $header->toaddress;
$message['ccaddress'] = $header->ccaddress;
$message['date'] = $header->date;
if (check_type($structure))
{
$message['body'] = imap_fetchbody($mbox,$messageid,"1"); ## GET THE BODY OF MULTI-PART MESSAGE
if(!$message['body']) {$message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\n\n';}
}
else
{
$message['body'] = imap_body($mbox, $messageid);
if(!$message['body']) {$message['body'] = '[NO TEXT ENTERED INTO THE MESSAGE]\n\n';}
}
return $message;
}
?>But I have looked high and low (from here, php.net to searching through google) to find something that actually receives the e-mail's attachment data.
Any help would be greatly appreciated!
Thanks!!!
feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]