|
|
|
|
![]() ![]() |
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> |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 6th September 2008 - 06:05 AM |