Motlive Posted January 28, 2009 Share Posted January 28, 2009 Anyone know a way to delete all the emails inside a mail box? I know how to get it to read and display the current mailbox info (easy enough) but deleting all emails via a single click eludes me. Any help appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/ Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Are we talking about an actual mailbox, as in via the user interface? Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748313 Share on other sites More sharing options...
Motlive Posted January 28, 2009 Author Share Posted January 28, 2009 yes.. Ive got the frontend bit sorted.. logging into the mail box and showing the mail box info.. but cant for the life of me figure out how to delete all the email in the box. Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748317 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Where are you storing the mail. What mail system are you using? Are you trying to find out how the user should do it, how the backend should do it? Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748321 Share on other sites More sharing options...
Motlive Posted January 28, 2009 Author Share Posted January 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748324 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Sorry, I don't think I can help, but my recommendation would be to use a webmail type front end. Though if you're using the imap set of function take a look at this Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748339 Share on other sites More sharing options...
Motlive Posted January 28, 2009 Author Share Posted January 28, 2009 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/142768-solved-delete-all-mail/#findComment-748341 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.