|
<?
# **********************************************************
# データの読出し
# **********************************************************
function GetData( ) {
global $ErrMessage;
global $MessageCount;
global $Mail;
global $OutData;
# メッセージのヘッダ情報の概要
$MailStruct = imap_fetchstructure( $Mail, $_POST['uid'], FT_UID );
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>タイプ</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->type;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>エンコーディング</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->encoding;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>サブタイプの有無</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->ifsubtype;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
if ( $MailStruct->ifsubtype ) {
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>サブタイプ</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->subtype;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
}
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>行数</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->lines;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>バイト数</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $MailStruct->bytes;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>パートの数</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= count($MailStruct->parts);
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
if ( $MailStruct->type == 0 &&
$MailStruct->ifsubtype &&
$MailStruct->subtype == 'PLAIN' &&
count($MailStruct->parts) == 0 ) {
$Body =
imap_body( $Mail, $_POST['uid'], FT_UID | FT_PEEK );
$Body = mb_convert_encoding(
$Body,
"SJIS",
"JIS"
);
$Body = str_Replace( "\r\n", "<br>", $Body );
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>本文</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $Body;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
}
if ( $MailStruct->type == 1 &&
$MailStruct->ifsubtype &&
$MailStruct->subtype == 'ALTERNATIVE' &&
count($MailStruct->parts) == 2 ) {
$Body =
imap_fetchbody ( $Mail, $_POST['uid'], "1", FT_UID | FT_PEEK );
$Body = mb_convert_encoding(
$Body,
"SJIS",
"JIS"
);
$Body = str_Replace( "\r\n", "<br>", $Body );
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>本文(1)</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $Body;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
$Body =
imap_fetchbody( $Mail, $_POST['uid'], "2", FT_UID | FT_PEEK );
$Body = quoted_printable_decode( $Body );
$Body = htmlentities( mb_convert_encoding(
$Body,
"SJIS",
"JIS"
) );
$Body = str_Replace( "\r\n", "<br>", $Body );
$OutData .= "<TR>\n";
$OutData .= "<TD class=MyCell>本文(2)</TD>";
$OutData .= "<TD class=MyCell>";
$OutData .= $Body;
$OutData .= "</TD>\n";
$OutData .= "</TR>\n";
}
}
# **********************************************************
# 画面の編集
# **********************************************************
function EditDataHead( ) {
}
# **********************************************************
# エラーチェック
# **********************************************************
function CheckDataHead( ) {
global $ErrMessage;
global $Mail;
global $MessageCount;
$MessageCount = imap_num_msg( $Mail );
if ( $MessageCount == 0 ) {
$ErrMessage = "メールボックスは空です";
}
}
?>
| |