PHP获取OUTLOOK邮件未读数
/*** 获取用户outlook未读邮件数
* @return type
*/
function getUnread_outlook() {
$host = '{mail.hostuc.net:993/imap/ssl}INBOX';
$userName= 'xx@xx.com';
$password= 'xx';
$inbox = imap_open($host, $userName, $password);
$total = imap_num_msg($inbox);
$unseen = 0;
for ($i = 0; $i <= $total; $i++) {
$headers = imap_headerinfo($inbox, $i); //获取信件标头
if ($headers->Unseen == 'U') {
$unseen++;
}
}
return $unseen;
}
页:
[1]