The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    1
    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:
    38
    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!
     
  3. roby2k

    roby2k Member

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

    roby2k Member

    Joined:
    Feb 2, 2003
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    -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:
    38
    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!
     
  6. freedman

    freedman Well-Known Member

    Joined:
    Feb 13, 2005
    Messages:
    312
    Likes Received:
    1
    Trophy Points:
    18
    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:
    16
    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:
    1
    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