发布网友 发布时间:2022-04-06 06:48
共2个回答
懂视网 时间:2022-04-06 11:09
PHP使用POP3读取邮箱接收邮件的实例解析:直接上代码:<php $array_values['host'] = "host"; $array_values['port'] = 110; $array_values['user'] = '用户名'; $array_values['password&热心网友 时间:2022-04-06 08:17
给你一个用 PEAR 的类库的例子:
<?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