高分求php收邮件例子(以前没接触过,有急用),谢了先!!! 用imap函数,不过关键是附件。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用imap函数,不过关键是附件。我收附件也不会。大家老讨论啊~~~~~``````` 用imap函数,好像还得imap客户端什么的,imap客户端我下不到啊!!!请大家再讨论一下 找到你的php.ini,将;extension=php_imap.dll 改为 extension=php_imap.dll然后用这段代码试试:<? $mbox = imap_open("{pop3.163.com/pop3:110}INBOX","用户名","密码"); $aaa = imap_check($mbox); print $aaa->Nmsgs; //邮件数目 $message = imap_body($mbox, 1); //获取第一封信 imap_close($mbox); echo $message;?> 提醒楼上的,楼主想要的是一个简单的邮件系统,你这只是调试php是否可以支持imap函数,回答不符合题意,打回重写 http://sourceforge.net/ 有你要的东西,但都是E文的... 应该知道imap函数用法吧(如果不会请参阅相关资料),我认为用imap函数收邮件比较简单。--------收件箱里的信件列表-------$server = "{pop3.sina.com/pop3}"; //邮件服务器$mailbox = "inbox"; //收件箱$mailaccount="xxxx";//用户名$mailpasswd="yyyy"; //密码$stream = @imap_open($server.$mailbox,$mailaccount,$mailpasswd);//打开IMAP 连结$mail_number = imap_num_msg($stream);//信件的个数for($i=0;$i<$mail_number;$i++){ $mail_header= imap_headerinfo($stream, $msgnum);//邮件头部 $subject = $mail_header->subject;//邮件标题 if(stristr($subject, "=?gb2312")) { //编码为简体中文的标题 $subject=substr($subject,11); $subject=substr($subject,0,-2); $subject=imap_base64($subject); } $from = $mail_header->fromaddress;//发件人 $date = $mail_header->date;//日期 $size = $mail_header->Size;//大小 echo ".....";//......显示出邮件列表......}-------阅读某个信件-------$stream = @imap_open($server.$mailbox,$mailaccount,$mailpasswd)$struct = imap_fetchstructure($stream, $number);$encoding = $struct->encoding;$body = imap_fetchbody ($stream, $number,1);switch($encoding) //如果信件是普通的而且没有附件{ case 3: $body = imap_base64($body); $body = nl2br($body); break; case 4: $body = imap_qprint($body); break;}如果是HTML或带附件的信件就比较麻烦了,要写几个函数来循环读取邮件的各个部分。 wamp集成环境不能自动解析根目录 java的32位MD5加密与php中的32位MD5加密结果不一样。求帮助。急急急 显示MYSQL数据乱码问题 贴下你最近项目的AB值? pdf 安装问题 动态增加文本框,怎样把多行数据增加到数据库? 请问PHP中怎么分页?(最简单的,不用函数) 如何跨窗体操作?? 求援!!!!! Wordpress网站 上传云主机后访问页面 后面自动加8080 那里能有关于$_*的php系统"变量"资料?js与PHP怎么互相交换数据?(在线...) 关于变量名代换的问题,救急!
我收附件也不会。
大家老讨论啊~~~~~```````
请大家再讨论一下
<?
$mbox = imap_open("{pop3.163.com/pop3:110}INBOX","用户名","密码");
$aaa = imap_check($mbox);
print $aaa->Nmsgs; //邮件数目 $message = imap_body($mbox, 1); //获取第一封信
imap_close($mbox);
echo $message;
?>
$server = "{pop3.sina.com/pop3}"; //邮件服务器
$mailbox = "inbox"; //收件箱
$mailaccount="xxxx";//用户名
$mailpasswd="yyyy"; //密码
$stream = @imap_open($server.$mailbox,$mailaccount,$mailpasswd);
//打开IMAP 连结
$mail_number = imap_num_msg($stream);//信件的个数
for($i=0;$i<$mail_number;$i++)
{
$mail_header= imap_headerinfo($stream, $msgnum);//邮件头部
$subject = $mail_header->subject;//邮件标题
if(stristr($subject, "=?gb2312"))
{ //编码为简体中文的标题
$subject=substr($subject,11);
$subject=substr($subject,0,-2);
$subject=imap_base64($subject);
}
$from = $mail_header->fromaddress;//发件人
$date = $mail_header->date;//日期
$size = $mail_header->Size;//大小
echo ".....";//......显示出邮件列表......
}-------阅读某个信件-------
$stream = @imap_open($server.$mailbox,$mailaccount,$mailpasswd)
$struct = imap_fetchstructure($stream, $number);
$encoding = $struct->encoding;
$body = imap_fetchbody ($stream, $number,1);
switch($encoding) //如果信件是普通的而且没有附件
{
case 3:
$body = imap_base64($body);
$body = nl2br($body);
break;
case 4:
$body = imap_qprint($body);
break;
}
如果是HTML或带附件的信件就比较麻烦了,要写几个函数来循环读取邮件的各个部分。