来源:网络 | 2012-9-2 | (有3044人读过)
如果有自己的linux主机,可以自行安装pear库,如果没,需要联系主机商问下,主机是否支持pear的pop3收邮件方式:
<?php require_once('Net/POP3.php');
$pop3 =& new Net_POP3; $pop3->connect('localhost', 110); $pop3->login('popuser', 'poppassword', false); $msgCnt = $pop3->numMsg(); $headers = $pop3->getParsedHeaders($msgCnt); $from = mb_decode_mimeheader($headers['From']); $subject = mb_decode_mimeheader($headers['Subject']); $content = $pop3->getBody($msgCnt); $pop3->disconnect();
echo "From: $from\n"; echo "Subject: $subject\n"; echo "Body: $content\n";
?>
安装类库的命令 pear install Net_Pop3
|