Code Examples / Notes » imap_delete

james g

I had some major issues deleting emails using this function. Using IIS 5.0 and a win based Mail Server, I could not delete the emails individually.
My script merely needed to check the emails and update the database for bounce backs, after which I simply wanted to erase all emails.
If imap_delete($mbox,$email->MsgNo) just isnt working for you, you can try using
imap_delete($mbox,'1:*');
to clear out an entire mailbox.
Hope this helps cause it drove me insane for about 5 hours. :)

jacky

// is not a complete code but enough to clear out an entire mailbox.
// hope this can save your time :-)
<?php
if (isset($_REQUEST['DoNow']))
{
# PULL ADDITIONAL FILES
include_once ("common.php");