This script will give you a listing of your messages in your Inbox folder with the first 50 characters of the subject line;
$mbox = imap_open ("{localhost:143/notls}Inbox", $username, $password) or die("can't connect: " . imap_last_error());
echo "<p><h2>Messages in Inbox</h2>\n";
for ($i = 1; $i <= imap_num_msg($mbox); $i++) {
$header = imap_fetchheader ($mbox,$i);
$first=strstr($header, "Subject:");
$subject=substr($first, 0,50);
echo "Msg. # $i - $subject [<a href='view_mail.php?message=$i&username=$username&password=$password'>View Message</a>]<br>\n";
}
imap_close($mbox);
And this will display a single message with the header in one text box and the body in anaother.
$mbox = imap_open ("{localhost:143/notls}Inbox", $username, $password);
$header = imap_fetchheader ($mbox,$message);
echo "<textarea cols='100' rows='25' wrap>$header</textarea>\n";
$body = imap_body ($mbox, $message, FT_PEEK);
echo "<p><textarea cols='100' rows='25' wrap>$body</textarea>\n";
imap_close($mbox);