xuxiaohui9216 发表于 2015-9-13 12:45:55

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]
查看完整版本: PHP获取OUTLOOK邮件未读数