Mobile app version of vmapp.org
Login or Join
Debbie626

: How to bulk delete email accounts from cPanel / my hosting account? I'd like to delete a few hundred email accounts from my domain (it's not all of them). I've looked and looked. cPanel and

@Debbie626

Posted in: #Cpanel #Email #Hostgator

I'd like to delete a few hundred email accounts from my domain (it's not all of them).

I've looked and looked. cPanel and Hostgator allow you to bulk-create email accounts and forwarders and there may be a way to bulk-delete forwarders but there doesn't seem to be a way to delete email accounts -- except one click at a time.

So, if I have 197 email accounts to delete:

account_003@mydomain.com
account_004@mydomain.com
account_012@mydomain.com
account_027@mydomain.com
etc...


How can I do this in bulk?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Debbie626

1 Comments

Sorted by latest first Latest Oldest Best

 

@Debbie626

Finally stumbled on the delpop command and cPanel's command-line interface.

So, assuming:


You have SSH access to your account
Your host has installed cPanel in the usual way


Then you can delete a single email account with this command, using an SSH client like PuTTY:

/usr/local/cpanel/cpanel-email delpop account_003 0 mydomain.com






To delete many accounts, all on domain mydomain.com, do this:


Create a text file, delemails.txt, with each account name on its own line:

account_003
account_004
account_012
account_027
etc...

FTP that file onto your server into a convenient location.
SSH onto your server and cd to the location where you placed delemails.txt
Run this command from the SSH shell:

for i in `cat delemails.txt`; do /usr/local/cpanel/cpanel-email delpop "$i" 0 mydomain.com ; done


It takes a couple of minutes to loop through 197 accounts and you'll see status messages printing for each account.
Done!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme