【发布时间】:2013-05-21 01:52:59
【问题描述】:
我对 PHP 的 PEAR 扩展非常陌生,想知道如何使用 PEAR 列出邮箱中的所有消息。我已经成功地制作了一个可以找到您最近的消息的程序,但我想制作它以便它可以列出您邮箱中的所有消息。我相信这可以使用 PEAR 的 pop3 部分来完成,但我不确定如何去做。有人有什么想法吗?这可能与梨有关吗? 我目前有这个代码来列出最近的消息:
//create pear object
require_once 'Net/POP3.php';
$pop3 =& new Net_POP3();
//connect to email provider
if(PEAR::isError($ret = $pop3->connect($host, $port))){
throw new ConnException($ret->getMessage());
}
if(PEAR::isError($ret = $pop3->login($user, $pass, 'USER'))){
throw new ConnException($ret->getMessage());
}
//get num messages and mailbox size
echo $pop3->numMsg() . ' messages in mailbox, ' . $pop3->getSize() . ' bytes <br/>';
//get the headers for the most recent message
if($pop3->numMsg() > 0){
$msgData = $pop3->getParsedHeaders($pop3->numMsg());
echo 'The most recent email in your inbox is from ' .htmlentities($msgData['From']) . ' with the subject \'' . htmlentities($msgData['Subject']) . '\'';
}
//disconnect from the provider
$pop3->disconnect();
有人可以给我一些提示或代码,将其修改为列出邮箱中的所有消息吗? 谢谢!
【问题讨论】:
-
@YourCommonSense 像什么?我们不应该在这里聊天,所以在这里和我谈谈chat.stackoverflow.com/rooms/31188/php-help-for-new-programmers
-
@YourCommonSense 就像我说的:你不能在这里聊天。使用我发送的链接....我现在将标记您的聊天评论以供版主审核。