imap_delete
imap_delete
Mark a message for deletion from current mailbox
true **imap_delete** IMAP\Connection $imap string $message_nums int $flags
Marks messages listed in for deletion.
Messages marked for deletion will stay in the mailbox until either
is called or
is called with the optional parameter
.
message_nums``imap_expunge``imap_close``CL_EXPUNGE
message_nums
A string representing one or more messages in IMAP4-style sequence format
(, , or combination of these
delimited by commas).
"n"``"n:m"
flags
You can set the which tells the function
to treat the argument as a
.
FT_UID``message_nums``UID
return.true.always
Throws a if
is invalid.
ValueError``flags
Voorbeeld: example
<?php
$mbox = imap_open("{imap.example.org}INBOX", "username", "password")
or die("Can't connect: " . imap_last_error());
$check = imap_mailboxmsginfo($mbox);
echo "Messages before delete: " . $check->Nmsgs . "<br />\n";
imap_delete($mbox, 1);
$check = imap_mailboxmsginfo($mbox);
echo "Messages after delete: " . $check->Nmsgs . "<br />\n";
imap_expunge($mbox);
$check = imap_mailboxmsginfo($mbox);
echo "Messages after expunge: " . $check->Nmsgs . "<br />\n";
imap_close($mbox);
?>
Opmerking: > IMAP mailboxes may not have their message flags saved between connections, so should be called during the same connection in order to guarantee that messages marked for deletion will actually be purged.
imap_expunge
imap_undelete``imap_expunge``imap_close