$mylink=imap_open("{localhost:143}","zz","zz");
$mail_number = imap_num_msg($mylink);
echo "<table>";
echo "<tr><td>No</td><td>主题</td><td>发件人</td><td>日期</td><td>字节</td></tr>";
for($n = 0; $n <= $mail_number; $n++)
{
$mail_header = imap_headerinfo($mylink, $n);
$subject = $mail_header->subject;
$from = $mail_header->fromaddress;
$fromarray = $mail_header->from;
if(stristr($from,"=?gb2312"))//汉字
{
$from = substr($from,11);
$from_host = strstr($from,"<");
$from = substr($from,0,strpos($from,"?="));
$from = imap_base64($from)." ".$from_host;
}
$date = $mail_header->date;
$date = substr($date,5,11);
$size = $mail_header->Size;
echo "<tr><td>$n</td>";
echo "<td><a href=readmail.php?no=$n>$subject</a></td>";
echo "<td>$from</td>";
echo "<td>$date</td><td>$size</td></tr>";
}
echo "</table>";
$mail_number = imap_num_msg($mylink);
echo "<table>";
echo "<tr><td>No</td><td>主题</td><td>发件人</td><td>日期</td><td>字节</td></tr>";
for($n = 0; $n <= $mail_number; $n++)
{
$mail_header = imap_headerinfo($mylink, $n);
$subject = $mail_header->subject;
$from = $mail_header->fromaddress;
$fromarray = $mail_header->from;
if(stristr($from,"=?gb2312"))//汉字
{
$from = substr($from,11);
$from_host = strstr($from,"<");
$from = substr($from,0,strpos($from,"?="));
$from = imap_base64($from)." ".$from_host;
}
$date = $mail_header->date;
$date = substr($date,5,11);
$size = $mail_header->Size;
echo "<tr><td>$n</td>";
echo "<td><a href=readmail.php?no=$n>$subject</a></td>";
echo "<td>$from</td>";
echo "<td>$date</td><td>$size</td></tr>";
}
echo "</table>";
谢谢,这40分一定给你啦,我还有个函数不知道怎么用,你可以告诉我吗?就是imap_append(),我不知道它怎么用的。我会再加20分上去的,好吗?当然,如果你没有回答,我午睡后,就结贴啦。
大概它和imap_mail()应该是差不多的只不过它是自己给自己发的,我是这么理解的。$stream = imap_open("{your.imap.host}INBOX.Drafts","username", "password");
$check = imap_check($stream);
print "Msg Count before append: ". $check->Nmsgs."\n";
imap_append($stream,"{your.imap.host}INBOX.Drafts"
,"From: [email protected]\r\n"
."To: [email protected]\r\n"
."Subject: test\r\n"
."\r\n"
."this is a test message, please ignore\r\n"
);$check = imap_check($stream);
print "Msg Count after append : ". $check->Nmsgs."\n";imap_close($stream);
http://www.mistruster.com/book/php.chm
英文版的(比较全):
http://www.mistruster.com/book/php_manual_en.zip
http://expert.csdn.net/Expert/topic/1827/1827661.xml?temp=.2373926