$mbox = imap_open(…);
$MC = imap_check($mbox);
die(var_dump($MC->Nmsgs));
// Fetch an overview for all messages in INBOX
$result = imap_fetch_overview($mbox,”1:{$MC->Nmsgs}”,0);
foreach ($result as $overview) {
echo “#{$overview->msgno} ({$overview->date}) - From: {$overview->from}
{$overview->subject}\n”;
}
imap_close($mbox);
这是一段常用的代码,在我这去不工作 ,imap_check可以,但是imap_fetch_overview不可以。郁闷,算了,绕道!
Posted in
未分类 at 12月 13th, 2008.
No Comments.
imap,一个类似pop3,优于pop3的东东。
简单记录一下安装过程
1. 下载imap_2007 (ftp.cac.washington.edu 可以下载到)
2. tar -zxf imap-xxxxx.tar.Z
cd imap-xxxxx
make slx
ln -sf c-client include
ln -sf c-client lib
进入php安装程序目录
./configure –with-openssl=/usr/local/ssl –with-imap-ssl=/usr/local/ssl –with-imap=../imap-xxxxx (imap路径可以自己换)
注意,没有 enable ssl,编译不会报错,但是,执行php函数时,可能会导致一个 remote什么的错误
有些机器编译时,还会出现一个ext/imap/.libs/php_imap.o(.text+0×2b8d): In function `zif_imap_expunge’:
: undefined reference to `mail_expunge_full’的错误。
解决方法:在php安装目录找到 ext/imap/php_imap.c 增加以下代码
long mail_expunge_full (MAILSTREAM *stream,char *sequence,long options)
{
/* do the driver’s action */
return stream->dtb ? (*stream->dtb->expunge) (stream,sequence,options) : NIL;
}
重新编译即可。
Posted in
未分类 at 12月 12th, 2008.
No Comments.