Create bulk email accounts in cPanel

Create bulk email accounts in cPanel

Lately I’ve been dealing a lot with email accounts in cPanel: Bulk change cPanel mailbox quota for all email ✉️ accounts and Bulk delete ✉️ email forwarders 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

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.