Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

how can i empty a pop3 account

Discussion in 'General Discussion' started by roby2k, Feb 1, 2007.

  1. roby2k

    roby2k Member

    Joined:
    Feb 2, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    151
    8k emails in one email account i want to remove them all any quick and easy way?
     
  2. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    168
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    try:

    Code:
    rm /home/user/mail/domain.com/emailaccount/new/*
    or perhaps more robustly:


    Code:
    cd /home/user/mail/domain.com/emailaccount
    rm cur/* new/*

    Voila - empty account!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. roby2k

    roby2k Member

    Joined:
    Feb 2, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    151
    wil give this ago cheers :)
     
  4. roby2k

    roby2k Member

    Joined:
    Feb 2, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    151
    -bash: /bin/rm: Argument list too long
    oan@outallnite.co.uk [~/mail]#

    is what error i got

    im trying to delete all of the inbox of the cpanel username.
     
  5. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    168
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    Try this:
    Code:
    find /home/user/mail/domain.com/emailaccount/cur -type f | xargs rm -f
    find /home/user/mail/domain.com/emailaccount/new -type f | xargs rm -f
    Be sure you get the path right!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    168
    if that's the case, then reference the post below to CD to the 'mailbox'

    then:
    cd cur
    rm -rf .
    cd ../new
    rm -rf .

    that should deletee all the files within each folder if your file list is too long from the globbing.
     
  7. kistler

    kistler Well-Known Member

    Joined:
    Jan 27, 2005
    Messages:
    136
    Likes Received:
    0
    Trophy Points:
    166
    The above does work but if you have a dedicated server you could use Config Server's mail management system, http://www.configserver.com/ which can make life easy.
     
  8. tnfezda

    tnfezda Member

    Joined:
    Jul 23, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    151
    you can also use this nice little php script. i have attached the file popclear.php.txt or you can create your own with the code below
    PHP:
    <?
    #######################################################################
    # INFO                                                                #
    # POPClear allows you to delete all the messages in a POP3 mailbox    #
    # without downloading or viewing any of the messages. It's perfect    #
    # for a mailbox you never use that gets nothing but spam.             #
    #                                                                     #
    # USAGE                                                               #
    # Requires PHP4. Set the $host, $user, and $pass variables below and  #
    # execute the script.                                                 #
    #                                                                     #
    # LICENSE                                                             #
    # This script is absolutely free. Use at will. The author is not      #
    # responsible for lost email, blown up servers, or anything else that #
    # results from the use of this script.                                #
    #######################################################################

    $host "mail.yoursite.com";
    $user "user@yoursite.com";
    $pass "password";

    #######################################################################
    # End Configuration                                                   #
    #######################################################################
    #Until I rewrite my scripts, this will suffice for bg-compatibility;
    if(phpversion() >= "4.2.0"){
       
    extract($_POST);
       
    extract($_SERVER);
       
    extract($_ENV);
    }

    #Format output for console or for web?
    $nl = ((isset($REMOTE_ADDR)) ? "<br>" "\n");

    if(!
    $sock=fsockopen($host110$err$errno10))
      die(
    "Couldn't connect to the POP server$nl");

    fputs($sock"USER $user\r\n");
    $buf fgets($sock1024);
    if(
    $buf[0] != '+')
      die(
    "POP server didn't like USER $user$nl");
    fputs($sock"PASS $pass\r\n");
    $buf fgets($sock1024);
    if(
    $buf[0] != '+')
      die(
    "POP server didn't like PASS$nl");

    fputs($sock"STAT\r\n");
    $buf fgets($sock1024);
    fputs($sock"STAT\r\n");
    $buf2 fgets($sock1024);
    list(
    $stat$num$size) = split(' '$buf23);
    echo 
    "There are $num messages$nl";

    for(
    $i=1$i<=$num$i++){
       
    $command "DELE $i\r\n";
       echo 
    "Deleting message $i with DELE $i$nl";
       
    fputs($sock$command);
       
    $buf fgets($sock1024);
       if(
    $buf[0] != '+')
         die(
    "POP server didn't like DELE $i: ($buf)$nl");
    }

    fputs($sock"QUIT\r\n");
    $buf fgets($sock1024);
    fclose($sock);

    ?>
     

    Attached Files:

Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice