If you know how to program, the quick way is to review the API documentation and use an array to create them. Otherwise, you could do the following, but this isn't guaranteed to always work since you aren't using the API (and scripts can change outside the API):
1. Create a file with all the email addresses, passwords and quotas in it in this format
Here
[email protected] is the first email for the first existing domain on an account. The domain must exist, while the email account cannot exist. The pass1 represents the password for that first email account. The 250 represents 250MB for that first account. Revise the values in the file accordingly and call the file /root/newemail for the following script I am about to provide.
2. Create the script to create the email accounts:
Code:
#!/bin/sh
while read x ; do \
xEMAIL=`echo $x | cut -d' ' -f1`
xPASS=`echo $x | cut -d' ' -f2`
xQUOTA=`echo $x | cut -d' ' -f3`
/usr/local/cpanel/scripts/addpop $xEMAIL $xPASS $xQUOTA
done < /root/newemail
This script could be called /usr/local/cpanel/scripts/createemail or something of that nature. If you do call it that, then make sure you create execute permissions on it:
Code:
chmod +x /usr/local/cpanel/scripts/createemail
3. Run the script in command line:
Code:
/usr/local/cpanel/scripts/createemail
It worked for me following the above steps just fine:
If the domains don't already exist, you'll have to create the domains as they need to exist for this to work. The /usr/local/cpanel/scripts/addpop script that already exists under cPanel can only associate the email addresses properly if the domain is owned by an account.
You are very welcome!