Bulk email accounts

We can create any number of email user accounts under particular domain using below one line script, on any cPanel servers.

This script requires input file that contains email username and password in the form of “username:password” without double quotes for the domain “domain.com” as given below.

$ cat users.txt

user1:C!5%aBpwMYs<1nx(
user2:P<kk%arM9e*7$3y?
user3:1)W9P%JWFhyn%1j#
user4:kXR7w?(4Q?T%$JMe
user5:]?MHTAn?!f^C1CzK
user6:a5?YF+sd321Xs8ez
user7:`jSgbX*VAcFdPA1]
user8:E8@hcPWx1`d?(&Jf
user9:()sC+2sH$8P]cakw
user10:j6aQtfgW4t73`tH9

Shell script

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

Where users.txt is a text file that contains username and password separated by colon. And of course, don’t forget to replace domain.com with your domain name.

Above script will create email accounts with unlimited disk quota.  If you want to  add limit, use –quota as below;

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

Above script will create email accounts with 100M disk quota.

user1@domain.com
user2@domain.com
user3@domain.com
user4@domain.com
user5@domain.com
user6@domain.com
user7@domain.com
user8@domain.com
user9@domain.com
user10@domain.com

—-x———-x———000———x———-x—-

If you would like to DELETE all the accounts created above, you may use below script;

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

Where userslist.txt is a text file that contains  list of email accounts  as below;

user1@domain.com
user2@domain.com
user3@domain.com
user4@domain.com
user5@domain.com
user6@domain.com
user7@domain.com
user8@domain.com
user9@domain.com
user10@domain.com

Hope it helps.

D KarthiKeyan