what is cpanelwhat is cpanel

Here is how to bulk create email accounts in cPanel under a single domain name.

First, let’s create a list of user accounts and passwords separated by colon:

cat users-list.txt
user1:3HVQw6KzSy28-tuK
user2:#2?kGZdr8N)e+K}S
user3:&Qa[;K49>%Dh4G)"
user4:'Ls;z/4;.pCT"=,K
user5:7N\[]m(hc![/,'b@
user6:%mBpwuz6R"+=EF-S
user7:SA_;k<,)j6`/V.6M

Then a shell script

for i in `cat users-list.txt`; do /scripts/addpop `echo $i|awk -F":" {'print $1'}`@domain.com  `echo $i|awk -F":" {'print $2'}`;done

This will set unlimited quota for all acoounts, to set a specific mailbox quota use -quota option:

for i in `cat users-list.txt`; do /scripts/addpop `echo $i|awk -F”:” {‘print $1’}`@domain.com  `echo $i|awk -F”:” {‘print $2’}`  –quota 100M;done

Email accounts will be created and the output will be::

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

To bulk delete all email accounts from a list, create another list:

cat delete-list.txt

then put the accounts in the following format:

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

and then use the following shell script:

for i in `cat  delete-list.txt`; do /usr/local/cpanel/scripts/delpop $i ;done