0
人可以帮我用代码来获取未读的Gmail邮件的数量到PHP的数量?如何获得未读的Gmail邮件
人可以帮我用代码来获取未读的Gmail邮件的数量到PHP的数量?如何获得未读的Gmail邮件
连接到使用从IMAP模块功能http://php.net/manual/en/book.imap.php
$mbox = imap_open("{imap.example.org:143}INBOX", "username", "password")
or die("can't connect: " . imap_last_error());
$MC = imap_check($mbox);
// Fetch an overview for all messages in INBOX
$result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0);
$seen = 0;
$unseen = 0;
foreach ($result as $overview) {
if($overview->seen){
$counter++;
} else {
$unseen++;
}
}
imap_close($mbox);
echo "Seen $seen, unseen $unseen"
你可以使用一些这个API,让您的收件箱供稿通过IMAP协议的Gmail:http://code.google.com/apis/gmail/docs/inbox_feed.html
但有很多库来访问这些的喂我在PHP我猜。
我还没有特里,因为我不知道如何开始 – Samjack
可能重复:http://stackoverflow.com/questions/7003150/how-to-get-gmail-unread-count –
欢迎来到SO!在问之前请始终Google。谷歌搜索'如何获得未读的Gmail邮件数量php'变成了好的结果。谢谢! –