imap Datei parsen und array Problem

palman

Grünschnabel
Hallo,

ich wollte eine eMail aus einer *.imap parsen und im Broweser dartellen, kriege jedoch Probleme mit dem Array bzw. "Array in einem Array":


Code:

PHP:
<?php 
/* 
* This is a simple email viewer. 
* make sure that $filename points to a file containing an email message and 
* load this page in your browser. 
* You will be able to choose a part to view. 
* */ 

$filename = "200709031327330012.imap"; 

/* parse the message and return a mime message resource */ 
$mime = mailparse_msg_parse_file($filename); 
/* return an array of message parts - this contsists of the names of the parts 
* only */ 
$struct = mailparse_msg_get_structure($mime); 
echo "<table>\n"; 
foreach($struct as $st) { 
$section = mailparse_msg_get_part($mime, $st); 
$info = mailparse_msg_get_part_data($section); 
print_r($info); 
} 
/* print a choice of sections*/ 
foreach($struct as $st) { 
echo "<tr>\n"; echo "<td><a href=\"$PHP_SELF?showpart=$st\">$st</a></td>\n"; 
/* get a handle on the message resource for a subsection */ 
$section =mailparse_msg_get_part 
/* get content-type, encoding and header informationfor that section */ 
$info =mailparse_msg_get_part_data($section); 
echo "\n"; 
echo "<td>" . $info["content-type"] . "</td>\n"; 
echo "<td>" . $info["headers"] . "</td>\n"; 
echo "<td>" . $info["disposition-filename"] . "</td>\n"; 
echo "<td>" . $info["charset"] . "</td>\n"; 
echo "<td>" . print_r($info['from']) . "</td>\n"; 
echo "</tr>"; 
} 
echo "</table>"; 
/* if we were called to display a part, do so now */ 
if ($showpart) { /* get a handle on the message resource for the desired part */ 
$section = mailparse_msg_get_part($mime, $showpart); 
echo "<table border=1><tr><th>Section $showpart</th></tr><tr><td>"; 
ob_start(); 
/* extract the part from the message file and dump it to the output buffer * */ 
mailparse_msg_extract_part_file($sec, $filename); 
$contents = ob_get_contents(); 
ob_end_clean(); 
/* quote the message for safe display in a browser */ 
echo nl2br(htmlentities($contents)) . "</td></tr></table>"; 
} 
?>

Ausgabe:

Code:
1	text/plain	Array	 UTF-8	1

kann mir jemand helfen? oder hat jemand einen besseren Vorschlag, wie ich die imap-Datei parsen und dastellen kann?

Vielen Dank im Voraus

greetz palman
 
Zurück