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.

Mass Email Account Removal

Discussion in 'E-mail Discussions' started by keithc, Jan 7, 2008.

  1. keithc

    keithc Member

    Joined:
    Jun 5, 2007
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    Was just wondering if anyone knows of a way to perform a mass removal of a bunch of email accounts. Over the years, the company I work for has given out a lot of free email addresses. Now, we are cleaning a lot of these up. I have about 300 email accounts I need to delete.

    Is there a way on the command-line to remove these accounts or another way in Cpanel besides deleting each account one at a time?

    I was thinking that just removing the email accounts from the domain's ./etc/passwd file might work since all of the accounts are listed there?

    Here is my Cpanel information

    WHM 11.11.0 cPanel 11.16.0-C18546
    CENTOS Enterprise 4.6 x86_64 on standard - WHM X v3.1.0

    Thanks,

    Keith
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    POP3 accounts aren't listed in /etc/passwd, they're stored within account/domain specific passwd/shadow files within /home/account/etc/...

    You can do this if you write a script that calls:

    /usr/local/cpanel/cpanel-email 'delpop' '<account>' '0' '<domain>'

    Substituting <account> and <domain> as appropriate. That said, this method wouldn't be endorsed by cPanel (you should really use the UI).
     
  3. keithc

    keithc Member

    Joined:
    Jun 5, 2007
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Chirpy.

    I tried to delete an account using this method but I may be doing it wrong.

    Let's say I have an account called test@testing.com

    Would I run /usr/local/cpanel/cpanel-email 'delpop' 'test' '0' 'testing.com'

    Thanks,

    Keith
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I missed a bit out - you have to run that under the cPanel account. So, for a POP account of test10@webumake.net which belongs to cPanel account webumake, you would use:

    su --login -s /bin/bash webumake -c "/usr/local/cpanel/cpanel-email 'delpop' 'test10' '0' 'webumake.net'"
     
Loading...

Share This Page