Jump to content

[SOLVED] Delete All Mail


Motlive

Recommended Posts

its just logging into a mail box on a pop3 server, so I have a form which has Server, username and password.. that then logs into the server and shows the contents. But I dont want it to do anything other than deleting all the email inside the mail box with a click of a link once logged in.

 

so its more a webmail script without any functionality except delete all.

Ahhh I did see that but couldnt figure out how to get it to delete all the email.. but further down saw the following which looks like it'll give me somewhere to stat from. Ta Very Much.

 

// 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"> 
  <input type="button" value="Cancel" name="Cancel" onClick='javascript:self.history.go(-1)'></form></p>
<?php
} ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.