2 include("../config/config.php");
3 include("../functions/mailbox.php");
4 include("../functions/strings.php");
5 include("../functions/page_header.php");
6 include("../functions/display_messages.php");
7 include("../functions/imap.php");
9 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
11 // switch to the mailbox, and get the number of messages in it.
12 selectMailbox($imapConnection, $mailbox, $numMessages);
14 if ($mailbox != $trash_folder) {
15 echo "ERROR -- I'm not in the trash folder!<BR>";
20 /** GET FOLDER ARRAY OF TRASH SUBFOLDERS **/
21 fputs($imapConnection, "1 list \"\" *\n");
22 $str = imapReadData($imapConnection);
24 for ($i = 0;$i < count($str); $i++
) {
25 $box = Chop($str[$i]);
26 $mailbox = findMailboxName($box);
28 if (strpos($box, $trash_folder) > 0) {
29 $folders[$i] = $mailbox;
31 $folders[$i] = "NOPE";
35 // mark them as deleted
36 setMessageFlag($imapConnection, 1, $numMessages, "Deleted");
37 expungeBox($imapConnection, $mailbox);
40 for ($i = 0; $i < count($folders); $i++
) {
41 if (($folders[$i] == "NOPE") ||
($folders[$i] == "$trash_folder")) {
43 $thisfolder = getFolderNameMinusINBOX($folders[$i]);
44 $thisfolder = "user.$username.$thisfolder";
45 removeFolder($imapConnection, $thisfolder);
49 selectMailbox($imapConnection, $trash_folder, $numMessages);
50 echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
51 displayPageHeader($mailbox);
52 messages_deleted_message($trash_folder, $sort, $startMessage);
53 fputs($imapConnection, "1 logout");