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. Dotworlds Free Domain Problem!(24)
  2. I Have A Girl Problem Here(24)
  3. My Dog Pukes Regularly(16)
  4. Remote Assistance Problem(7)
  5. Laptop Keyboard Problem(6)
  6. How To Reformat Your Harddrive...(10)
  7. Problem With My External Hard Disk(7)
  8. Two Lan Ports Problem(2)
  9. Rpg Maker 2003 Music Problem(2)
  10. Mysql-essential-5.0.51 Installion Problem(2)
  11. Can Anyone Help Me With My Graphic Card - 8600 Gt [resolved](15)
  12. Flash Problem(9)
  13. I'm Having A Strange Problem With My Ping In Cs:s(27)
  14. Team Fortress 2 Professional Spy Guide(1)
  15. Cannot Connect To Mail Server(3)
  1. Credits Problem(14)
  2. Why My Computer Freezez(4)
  3. Arrays And List Boxes(2)
  4. Please Can You Review My Blog(3)
  5. Recommended List Of Money Making Sites(0)
  6. Phpmyadmin Problem [resolved](2)
  7. Weird Write Problem(3)
  8. Fantastico And Cpanel Skin Problem.(1)
  9. Harddrive "open With..." Problem(1)
  10. Database Or Pdf(1)
  11. [chsupport #ecn-115724]: Ftp/cpanel Login Problem(7)
  12. Story Time!(2)
  13. Need Help: Problem Seeing My Site(3)


 



- Lo-Fi Version Time is now: 25th July 2008 - 10:37 AM