使用IMAP扩展连接POP3服务器
时间:2005-12-28 来源:manbuzhe0301
对IMAP扩展的简易应用。
很多POP3服务器拒绝连接,
所以会报错。
如果能花些时间,还是可以写出不错的邮件WEB客户端的。
Headers in INBOX共有 $num 封邮件。";
$obj = imap_fetch_overview($mbox, "1:$num");
foreach ($obj as $msgno => $value) {
$msgno++;
$headobj = imap_mime_header_decode($value->subject);
$fromobj = imap_mime_header_decode($value->from);
echo "".$headobj[0]->text."[".$fromobj[0]->text."]";
//print_r(imap_mime_header_decode($value->subject));
}
} else {
//show mail content
$body = imap_body($mbox, $id);
$msgobj = imap_fetch_overview($mbox, "$id");
$fromobj = imap_mime_header_decode($msgobj[0]->from);
//$body = imap_mime_header_decode($body);
echo "第 $id 条消息的内容:
";
echo "发件人:".$fromobj[0]->text."
";
echo "接收时间:".$msgobj[0]->date."";
echo imap_qprint($body)."
";
}
imap_close($mbox);
?>
很多POP3服务器拒绝连接,
所以会报错。
如果能花些时间,还是可以写出不错的邮件WEB客户端的。
Headers in INBOX共有 $num 封邮件。";
$obj = imap_fetch_overview($mbox, "1:$num");
foreach ($obj as $msgno => $value) {
$msgno++;
$headobj = imap_mime_header_decode($value->subject);
$fromobj = imap_mime_header_decode($value->from);
echo "".$headobj[0]->text."[".$fromobj[0]->text."]";
//print_r(imap_mime_header_decode($value->subject));
}
} else {
//show mail content
$body = imap_body($mbox, $id);
$msgobj = imap_fetch_overview($mbox, "$id");
$fromobj = imap_mime_header_decode($msgobj[0]->from);
//$body = imap_mime_header_decode($body);
echo "第 $id 条消息的内容:
";
echo "发件人:".$fromobj[0]->text."
";
echo "接收时间:".$msgobj[0]->date."";
echo imap_qprint($body)."
";
}
imap_close($mbox);
?>
相关阅读 更多 +