Moving multiple email accounts to cpanel

cisnet

Member
Nov 30, 2004
8
0
151
I think cpanel could really use a page that let you paste in a username/password list and then let you supply an ip address to let you run fetchmail against. But, since it doesn't.....

Is there a script to do this some where. I poked around the net for about 1/2 hour. I can't even find any help in adding an email account from the command line. Is there something in /scripts that I could use, just pass it the parameters in a shell script?

Thanks.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
I think cpanel could really use a page that let you paste in a username/password list and then let you supply an ip address to let you run fetchmail against. But, since it doesn't.....

Is there a script to do this some where. I poked around the net for about 1/2 hour. I can't even find any help in adding an email account from the command line. Is there something in /scripts that I could use, just pass it the parameters in a shell script?

Thanks.
For scripting the creation of email addresses, you may wish to call the API function the X3 theme calls to create this account. You can call that function from the XML-API.

To see the API function in use, view /usr/local/cpanel/base/frontend/x3/mail/doaddpopinclude.html

For documentation on the XML-API and how to call API1 and API2 functions from the XML-API, please visit:

http://www.cPanel.net/plugins/devel

You can use an API2 function to list all accounts:

http://www.cpanel.net/plugins/api2/Cpanel::Email::listpopswithdisk.pod.html

However, that function will not return the password of each account.
 

cisnet

Member
Nov 30, 2004
8
0
151
Well, this works.

while read NAME PASSWORD
do
echo "$NAME, $PASSWORD" #probably not needed. In for testing
/scripts/addpop $NAME $PASSWORD
done < mailadd.test


mailadd.test was a file with emailaddress password.

mailadd.test was a file with the emailadress/password combos. All were successfully created using the bash shell.
I haven't added a fetchmail line yet, but that shouldn't be too hard.
 
Last edited: