Creating a lot of email address in cPanel can be a real pain the neck considering that there is no way to create multiple email addresses at once. However, this task can be accomplished with iMacros, a macro plugin for Firefox, and a bit of php.
If you don't have iMacros installed, get it here. Once you get that installed, here are the steps.
Create your iMacros Script
Here is where you need some php skills. You'll need a list of your email addresses (username only), and passwords. These should be in a comma separated list like this:
jamese,sup3rs3cr3t
maxp,sh0p3rs7ar
jeremys,madsk1llz
Read on to get the php script...
Use this php script to generate the iMacros code. It just loops over your list and places the username and password into the right spots:
Back\n"; } ?>
The only thing you need to change in the script is the line that reads:
URL GOTO=http://www.mysite.com:2082/frontend/x3/mail/pops.html
Basically you need to login to cpanel, click on your Add/Remove Email Accounts or Email Accounts (it varies depending on your theme) to get that URL. Just to be totally clear, this is the page where you add email addresses. The url of that page is what needs to go on that line.
I run this code from my computer with WAMP, but you could run it from any server that supports PHP. After you run the script, just copy the results.
Read on to figure out how to make this work with iMacros...
Now start up Firefox, and start iMacros (there should be a button in your toolbar to open it).
And that's it. I know this tutorial will be out of date as soon as cPanel updates to a new default theme, and the exact iMacros code will be a bit different if you are using a different theme, but I hope this can act as a guide for you on how to do this. I guarantee that figuring out how to do this will be way faster than entering 100+ emails individually.
Comments (9)
Mar 06, 2008 at 02:59 AM
Tim:
Nice post! I think you can do all this without even using PHP. iMacros can read from CSV files directly. So in your macro just use CMDLINE !DATASOURCE Address.csv 'Number of columns in the CSV file. This must be accurate! SET !DATASOURCE_COLUMNS 1 'Start at line 2 to skip the header in the file SET !LOOP 2 And then use {{!COL1}} for your emails: TAG POS=1 TYPE=... CONTENT={{!COL1}} I got this idea from http://wiki.imacros.net/Demo-Loop-Csv-2-Web
Mar 06, 2008 at 11:52 AM
David Grega:
You can avoid the possibility of the code being obsoleted by a new GUI by accessing the APIs directly. You can use our XML-API to call the appropriate API1/API2 functions that handle the actual creation of mail accounts. If you have root access, all you have to do is analyze the code of the X3 theme to see what APIs it calls and use those calls yourself. The X3 theme is located at /usr/local/cpanel/base/frontend/x3 The paths for individual screens is fairly simple as it is merely a series of special web pages. For example, frontend/x3/mail/pops.html would be located at /usr/local/cpanel/base/frontend/x3/mail/pops.html - though all that particular page does is pass parameters to another page to be processed. The code is fairly simple and easy to sort though. We are currently working on comprehensive API documentation so you wont need to look at the X3 source code to determine which API calls you need to use. However, you can find our current documentation on our website at: http://www.cPanel.net/plugins/devel
Mar 06, 2008 at 03:36 PM
devtrench:
Awesome comments Guys! Thanks for your response and for the ideas!
Sep 12, 2008 at 05:15 AM
Vinod:
Thanks.. something we were looking for..It would certainly take some time as it is a macro.. but there will be atleast no pain ..\
Sep 28, 2008 at 05:24 PM
M Tee:
Hey, I just tried your script but whenever I run it says: Parse error: syntax error, unexpected ',' in /home/gktsmec/public_html/rep.php on line 2 The first line with $text Any help would be appreciated. Thanks.
Sep 28, 2008 at 08:15 PM
devtrench:
Hi M, Make sure the quote in line 2 is a normal quote. Wordpress likes to turn my quotes into fancy ones for some reason and PHP won't like that. That's all I can think it might be. James
Sep 10, 2009 at 11:34 AM
john:
I get the: SyntaxError: can not parse macro line: <?php What gives? I use the exact same coding.
Sep 11, 2009 at 03:44 PM
devtrench:
Sounds like you might be trying to enter php into the iMacros editor. You'll need to run the php from the command line or through a php enabled web server. If you don't know anything about PHP, then this method probably isn't for you.
Oct 07, 2010 at 07:01 PM
Josh:
In cPanel, if you have multiple add-on domains, you must choose a domain to create the email on, do you know of a way to select a specific domain from the drop down list with your guide you have helped us out with here?