Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Imap Status (unseen) Problem, i wrote a funtion to list the imap mailboxes and thiere stats
adly3000
post Feb 10 2006, 09:35 PM
Post #1


Member [Level 1]
****

Group: Members
Posts: 58
Joined: 31-January 06
Member No.: 17,937



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?!
CODE

<?
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>
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Free Classified Ads--no Hype(4)
  2. Problem Installing Sims 2 Nightlife(26)
  3. I Have A Girl Problem Here(27)
  4. Problem With Page Redirect(8)
  5. Php Header Problem(11)
  6. Dvd Drive Problem(10)
  7. Remote Assistance Problem(8)
  8. Laptop Keyboard Problem(7)
  9. How To Make A Counter Strike 1.6 Dedicated Server(16)
  10. Skype / Xampp Port Conflict(5)
  11. Free Sms Site(5)
  12. Data Structures -- Linked List(8)
  13. Problem Aligning In Firefox(9)
  14. List Of Free Games(9)
  15. Itunes Problem!(1)
  1. Top 10 Geek Ways To Beat Boredom(12)
  2. How Many More Times Will I Have To Post About This?(11)
  3. Problem Getting Text To Align With Different Resolutions(4)
  4. Youtube People That Do Not Respect Other Opinions(7)
  5. A Problem With Ftp Clients(9)
  6. Domain Problem : This Is Important..(0)
  7. Browser Compatibility Problem With Firefox - Javascript + Css(3)
  8. Terminating Hosting Problem(1)
  9. Problem With My Girlfriend Family, Need Suggestions For Action(2)
  10. Good Freeware List(3)
  11. My Poems(0)
  12. Tears For Her Love(0)
  13. Time Keeps Slipping By(0)


 



- Lo-Fi Version Time is now: 6th September 2008 - 06:05 AM