Is there a way to create mass email accounts from your cPanel or using PHP? [closed]
开发者_高级运维
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionI need to create a big number of emails accounts for my domain to accomplish a task. I was wondering if there is a way of doing this automatically. Maybe through cPanel or PHP.
Thank you for any ideas.
For creating email accounts without using cPanel directly you can use cPanel & WHM's API.
Look at the following forum post, it deals with same thing.
Create Email Account using API
Note: the XML-PHP API has moved to GitHub and is available at following link https://github.com/CpanelInc/xmlapi-php
You can download the 1.0.12 release from https://github.com/CpanelInc/xmlapi-php/zipball/v1.0.12
In the zip look at api1_example.php
in Examples directory it is what you want.
Update
In short you can do it like this from a PHP script
include("../xmlapi.php");
$ip = ip.of.your.server;
$root_pass = 'password_of_your_root_account';
$account = "cpanel_username";
// Email account to create
$email_user = "somerandomuser";
$email_password = "adfm90f1m3f0m0adf";
$email_domain = "somedomain.com";
$email_quota = '10';
// initialize api
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi->set_output('json');
$xmlapi->set_debug(1);
print $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) );
If you have Fantastico or Softaculous (or some other script installation wizard) on your cPanel (look for it under Software/Services) then you may be able to install a mailing list application and use that.
精彩评论