"; echo ""; // open a connection on the imap port (143) $imapConnection = loginToImapServer($username, $key, $imapServerAddress); fputs($imapConnection, "1 list \"\" *\n"); $str = imapReadData($imapConnection); echo "
"; echo "Folders
"; echo "(refresh folder list)

"; echo "\n"; for ($i = 0;$i < count($str); $i++) { $mailbox = Chop($str[$i]); $mailbox = findMailboxName($mailbox); // find the quote at the begining of the mailbox name. // i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name. $periodCount = countCharInString($mailbox, "."); // indent the correct number of spaces. for ($j = 0;$j < $periodCount;$j++) echo "  "; $mailboxURL = urlencode($mailbox); selectMailbox($imapConnection, $mailbox, $numNessages); $unseen = unseenMessages($imapConnection, $numUnseen); if ($unseen) echo ""; echo ""; echo readShortMailboxName($mailbox, "."); if (($move_to_trash == true) && ($mailbox == $trash_folder)) { $urlMailbox = urlencode($mailbox); echo "    (empty)"; } echo "\n"; if ($numUnseen > 0) { echo " ($numUnseen)"; } echo "
\n"; } echo "
"; fclose($imapConnection); ?>