Annotation of embedaddon/php/ext/imap/tests/clean.inc, revision 1.1.1.1

1.1       misho       1: <?php
                      2: include_once(dirname(__FILE__) . '/imap_include.inc');
                      3: 
                      4: $imap_stream = imap_open($default_mailbox, $username, $password);
                      5: 
                      6: // delete all msgs in default mailbox, i.e INBOX
                      7: $check = imap_check($imap_stream);
                      8: for ($i = 1; $i <= $check->Nmsgs; $i++) {
                      9:        imap_delete($imap_stream, $i); 
                     10: }
                     11: 
                     12: $mailboxes = imap_getmailboxes($imap_stream, $server, '*');
                     13: 
                     14: foreach($mailboxes as $value) {
                     15:        // Only delete mailboxes with our prefix
                     16:        if (preg_match('/\{.*?\}INBOX\.(.+)/', $value->name, $match) == 1) {
                     17:                if (strlen($match[1]) >= strlen($mailbox_prefix) 
                     18:                && substr_compare($match[1], $mailbox_prefix, 0, strlen($mailbox_prefix)) == 0) {
                     19:                        imap_deletemailbox($imap_stream, $value->name);
                     20:                }
                     21:        }       
                     22: }
                     23: 
                     24: imap_close($imap_stream, CL_EXPUNGE); 
                     25: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>