Location: PHPKode > scripts > MailDog > maildog/readheaders.html
<?
include('defaults.php3');

if ( empty($server) || empty($account) || empty($password) ) {
        Header("Location: $MAILDOG");
        exit;
}
?>
<html>
<head>
<meta charset="iso-8859-7">
</head>

<body bgcolor=white>
<font face=arial>
<?

	$msg_number=implode($argv," ");

Function dequote($mystring){
if (! eregi("=\?.*\?Q\?.*",$mystring )) {
        return $mystring;
}

array($stringlist);
$stringlist=explode(" ",$mystring);

$count=count($stringlist);

for ($i=0; $i<$count; $i++) {
#print "<h1> $strinlist[$i] </h1>\n";
        $tempstring=eregi_replace("\?=$","", $stringlist[$i]);
        $tempstring=eregi_replace("=.*\?","", $tempstring);
        $tempstring=imap_qprint($tempstring);
        $tempstring=ereg_replace("_"," ",$tempstring);
        if ( $i == 0 ) {
                $rstring = $tempstring;
        } else {
                $rstring = $rstring .  $tempstring;
        }
}

return $rstring;
}


$mbox = imap_open("{$server:143}INBOX",$account,$password,OP_READONLY);

$status=imap_check($mbox);
$num_msg=$status->Nmsgs;

array ($headers);
$headers=@imap_headers($mbox);
$smallheaders=trim(substr($headers[$msg_number-1],0,6));
if ( ereg("D",$smallheaders) ) {
                $deleted="<font color=red face=arial>Deleted</font>";
} 	else {
		$deleted="&nbsp;";
}


include('header.html'); 

$header=imap_header($mbox,$msg_number,1);
if ( empty($header) ) {
	echo("<br><br>
		<center><font color=red size=+1>
		<h3>No Message # $msg_number / Äåí õðÜñ÷åé ìÞíõìá # $msg_number</h3>		</font>
		</center>
	");
	exit;
} 

$fullheaders=@imap_fetchheader($mbox,$msg_number);


$body	=imap_fetchbody($mbox,$msg_number,1);
if ( strlen($body) <= 0 ) { $body= "Empty Message body"; }


$structure=imap_fetchstructure($mbox,$msg_number);
$extrabody="";

if ( eregi("MIXED",$structure->subtype) ) {
$extrabody="<br><hr><center> <br>
[ Mime Encoded Parts are not shown ] <br>
[ ÔìÞìáôá ôýðïõ MIME äåí åìöáíßæïíôáé óå áõôÞí ôç óåëßäá ] 
</center>";
}

$xbody=imap_qprint($body);
$mylen=strlen($xbody);
if ( $mylen > 10 ) {
        $body=$xbody;
}
$htmlbody      =htmlspecialchars($body);
$htmlbody	="<font face=terminal><pre>" . $htmlbody . "</pre>";

$fullheaders	= dequote($fullheaders);
$htmlfullheaders= htmlspecialchars($fullheaders);

echo ("
<font face=terminal color=\"#006699\"> 
<b>
<pre>
$htmlfullheaders
</pre>
</b>
</font>
<br>
<br>
		$htmlbody
		$extrabody
");


imap_close($mbox);
?>




</body>
</html>

<br><br>
<? exit; ?>
Return current item: MailDog