平淡,物质,精神
时间:2010-11-22 来源:ifind
),这下就可以让自己安静的心不起波澜了.
继续mail!贴上可以接收gmail等邮箱的代码(基于imap模块,这个东东不懂),具体细节慢慢分析.
<?php $mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "[email protected]", "password") or die("can't connect: " . imap_last_error()); $check_array = imap_check($mbox); echo "当前邮件数:".$check_array->Nmsgs."<br />"; for($i=1;$i<=$check_array->Nmsgs;$i++) { $msg_structure = imap_fetchstructure($mbox,$i); $foo=imap_header($mbox,$i); $from_array=$foo->from; $fr_array=$from_array[0]; $personal = $fr_array->personal; $mailbox = $fr_array->mailbox; $host = $fr_array->host; $from_address=$mailbox."@".$host; echo "标题: <a href='showmail.php?mailid=".$i."'>".$foo->Subject." "; echo "发件人: $personal".$msg_structure->bytes."字节<br />"; } imap_close($mbox); ?>
...
showmai
<?php $mailid = $_REQUEST['mailid']; $mbox = imap_open ("{imap.gmail.com:993/imap/ssl}INBOX", "[email protected]", "password"); if(!$mbox) { echo "Error on openning mailbox,Exit"; exit(); } else { $check_array = imap_check($mbox); if($mailid=="" || $mailid<1 || $mailid > $check_array->Nmsgs) { exit(); } $foo=imap_header($mbox,$mailid); $from_array=$foo->from; $fr_array=$from_array[0]; $personal = $fr_array->personal; $mailbox = $fr_array->mailbox; $host = $fr_array->host; $from_address=$mailbox."@".$host; echo "标题: ".$foo->Subject." "; echo "发件人: $personal $from_address"; echo " 正文...... <pre>"; $body = imap_body($mbox,$mailid); $body = imap_qprint($body); echo $body."</pre>"; imap_close($mbox); } ?>
在前人的基础上寻找精神享受.接下来玩两天数据结构,然后开始学习Mail,Net,Imap.
----11.22.2010
相关阅读 更多 +