Cloud Linux, Control Panel, CPanel / WHM

How to create bulk email accounts in 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

Then a shell script

for i in `cat users-list.txt`; do /scripts/addpop `echo $i|awk -F":" {'print $1'}`  `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’}`  `echo $i|awk -F”:” {‘print $2’}`  –quota 100M;done

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

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

cat delete-list.txt

then put the accounts in the following format:

and then use the following shell script:

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.