Jump to content
xisto Community
Sign in to follow this  
adly3000

Imap Status (unseen) Problem i wrote a funtion to list the imap mailboxes and thiere stats

Recommended Posts

i wrote a funtion to list the imap mailboxes and then write the usneen messages besides to thier relative mail boxes:
1- it will search the mail boxes and display the inbox at the top then it will display the remaining mailboxes.
everything working great, but always showing me unseen=0????!!
i don't know why?!

<?session_start();$mboxrit = @imap_open("{mail.adly3000.trap17.com:143}", "".$_SESSION['SESSION_USER_NAME']."+".$_SESSION['SESSION_MAIL_HOST']."", $_SESSION['SESSION_USER_PASS'],OP_HALFOPEN) or header("Location: error.php?ec=3");$list = imap_list($mboxrit,"{mail.adly3000.trap17.com:143}","*");function cmp ($desired_mailbox_name, $b){	if (strcasecmp($desired_mailbox_name, 'INBOX') == 0) {		return -1;	} elseif (strcasecmp($b, 'INBOX') == 0) {		return 1;	}}if (is_array($list)){		reset($list);	while(list($key, $val) = each($list))	{		$mailbox_name = imap_utf7_decode($val);		list($undesired_mailbox_name[$key], $desired_mailbox_name[$key]) = explode("}", $mailbox_name);	}	usort($desired_mailbox_name, 'cmp');	while(list($key, $val) = each($desired_mailbox_name))	{		if ($val != ".mailboxlist")		{			$mailbox_status = imap_status($mboxrit,"{mail.adly3000.trap17.com:143}".$val."",SA_UNSEEN);			if (isset($mailbox_status))				$unseen = $mailbox_status->unseen;			if (strstr($val, "."))			{				list($inbox,$boxname) = explode(".", $val);			}			$val = ((isset($boxname)) ? $boxname : $val);			$mailboxes = (isset($mailboxes) ? $mailboxes."<tr>" : "<tr>");			$mailboxes .= "<td>".$val;			if ($unseen > 0)					$mailboxes .= " (".$unseen.")";			$mailboxes .= "</td>";			$mailboxes .= "</tr>";		}	}}imap_close($mboxrit);?><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><table width="100%" border="0" cellspacing="0" cellpadding="0">  <? echo $mailboxes; ?></table></body></html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.