fox_statton
asked on
IMAP get entire message
Hi all,
Ive been struggling with this for a while, so hopefully someone can help.
This is a very simple script using PHP imap functions to read a mailbox. Is there a function I can use to get the entire source of the message (the same as I would see if I was viewing the source in outlook etc). So for a mime message I would get the entire thing, headers and everything?
<?php
$imap = imap_open("{SERVER}", "email@domain.com", "password");
$message_count = imap_num_msg($imap);
for ($i = 1; $i <= $message_count; ++$i) {
$header = imap_header($imap, $i);
$body = imap_fetchbody($imap, $i,$partno);
$prettydate = date("jS F Y", $header->udate);
if (isset($header->from[0]->p ersonal)) {
$personal = $header->from[0]->personal ;
} else {
$personal = $header->from[0]->mailbox;
}
$body=imap_base64($body);
$email = "$personal <{$header->from[0]->mailbo x}@{$heade r->from[0] ->host}>";
echo "On $prettydate, $email said \"$body\".\n";
}
imap_close($imap);
?>
Ive been struggling with this for a while, so hopefully someone can help.
This is a very simple script using PHP imap functions to read a mailbox. Is there a function I can use to get the entire source of the message (the same as I would see if I was viewing the source in outlook etc). So for a mime message I would get the entire thing, headers and everything?
<?php
$imap = imap_open("{SERVER}", "email@domain.com", "password");
$message_count = imap_num_msg($imap);
for ($i = 1; $i <= $message_count; ++$i) {
$header = imap_header($imap, $i);
$body = imap_fetchbody($imap, $i,$partno);
$prettydate = date("jS F Y", $header->udate);
if (isset($header->from[0]->p
$personal = $header->from[0]->personal
} else {
$personal = $header->from[0]->mailbox;
}
$body=imap_base64($body);
$email = "$personal <{$header->from[0]->mailbo
echo "On $prettydate, $email said \"$body\".\n";
}
imap_close($imap);
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points! Best of luck with your project, ~Ray
ASKER