PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imap_deletemailbox> <imap_createmailbox
Last updated: Sun, 25 Nov 2007

view this page in

imap_delete

(PHP 4, PHP 5)

imap_delete — 현재 메일 박스에서 삭제될 메시지를 표시한다

Description

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

TRUE를 리턴한다.

imap_delete()함수는 msg_number 번의 메시지를 지움 표시 한다. 선택적 인수flags 는 오직 하나의 옵션만 있다. 즉, msg_numberUID 로 취급할것인지 함수에게 알려주는 FT_UID 의 옵션만 있다. 지움 표시된 메시지는 imap_expunge()함수나 CL_EXPUNGE 옵션을 갖는 imap_close() 함수가 불려지기 전까지는 삭제되지 않는다.

Example#1 imap_delete() Beispiel

$mbox = imap_open ("{your.imap.host}INBOX", "username", "password")
    || die ("can't connect: " . imap_last_error());

$check = imap_mailboxmsginfo ($mbox);
print "Messages before delete: " . $check->Nmsgs . "<br>\n" ;
imap_delete ($mbox, 1);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after  delete: " . $check->Nmsgs . "<br>\n" ;
imap_expunge ($mbox);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after expunge: " . $check->Nmsgs . "<br>\n" ;
imap_close ($mbox);



add a note add a note User Contributed Notes
imap_delete
jacky at jackyhome dot myvnc dot com
09-Nov-2003 01:42
// 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");
 
 
$conn = @imap_open("\{$server/$serverType}Trash", $user, $pass)
  or die(
"Connection to folder failed");
 
 
$headers = @imap_check($conn);
  (
$headers->Nmsgs > 0) or die("Trash is empty already !");
 
 
// delete email(s)
 
@imap_delete($conn,'1:*');   // to clear out an entire mailbox.
 
@imap_expunge($conn);
  echo
"Trash is empty.";
 
 
imap_close($conn);
}
else
{
  echo
"<form name='formA' action='".$_SERVER['PATH_INFO']."' method='POST'>"; ?>
  Are you sure to empty trash ?
  <p>
  <input type="submit" value="Go Ahead" name="DoNow">&nbsp;
  <input type="button" value="Cancel" name="Cancel" onClick='javascript:self.history.go(-1)'></form></p>
<?php
} ?>
James G
09-Apr-2003 09:05
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.  :)

imap_deletemailbox> <imap_createmailbox
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites