imap_delete

(PHP3 , PHP4 )

imap_delete --  Mark a messge for deletion from current mailbox

Description

int imap_delete (int imap_stream, int msg_number [, int flags])

Returns true.

imap_delete() function marks message pointed by msg_number for deletion. The optional flags parameter only has a single option, FT_UID, which tells the function to treat the msg_number argument as a UID. Messages marked for deletion will stay in the mailbox until either imap_expunge() is called or imap_close() is called with the optional parameter CL_EXPUNGE.

Példa 1. Imap_delete() Beispiel

  1 
  2 $mbox = imap_open ("{your.imap.host}INBOX", "username", "password")
  3     || die ("can't connect: " . imap_last_error());
  4 
  5 $check = imap_mailboxmsginfo ($mbox);
  6 print "Messages before delete: " . $check->Nmsgs . "<br>\n" ;
  7 imap_delete ($mbox, 1);
  8 $check = imap_mailboxmsginfo ($mbox);
  9 print "Messages after  delete: " . $check->Nmsgs . "<br>\n" ;
 10 imap_expunge ($mbox);
 11 $check = imap_mailboxmsginfo ($mbox);
 12 print "Messages after expunge: " . $check->Nmsgs . "<br>\n" ;
 13 imap_close ($mbox);
 14