Can some tell me how to retrieve the body of an email, in plain text, then display it allowing for word wrap in a html table, without distorting the table.
I am current experiencing problems with this function. I can retrieve and read the body fine but I have to scroll across my browser to read the email, which totally distorts the html table. I would like it to wrap so other users and I don't have to do that.
here's the code I am using (there are other sections that displays the header info but I left that for this question):
<?
// open POP connection
$inbox = @imap_open ("{". $SESSION_MAIL_HOST . "/pop3:110}INBOX", $SESSION_USER_NAME, $SESSION_USER_PASS);
// get total messages
$total = imap_num_msg($inbox);
$headers = imap_header($inbox, $id);
$structure = imap_fetchstructure($inbox, $id);
// if multipart, parse
if(sizeof($structure->parts) > 1)
{
$sections = parse($structure);
$attachments = get_attachments($sections);
}
// if multipart, display text sections
if(is_array($sections))
{
for($x=0; $x<sizeof($sections); $x++)
{
if(($sections[$x]["type"] == "text/plain" || $sections[$x]["type"] == "message/rfc822") && $sections[$x]["disposition"] != "attachment")
{
echo htmlentities(stripslashes(trim(imap_fetchbody($inbox, $id, $sections[$x]["pid"]))));
}
}
}
else
{
echo htmlentities(stripslashes(trim(imap_body($inbox, $id))));
}
?>