【问题标题】:Create webmail account with PHP使用 PHP 创建 webmail 帐户
【发布时间】:2011-04-01 15:58:24
【问题描述】:

如何使用 PHP 创建 webmail 帐户?我正在使用 cPanel。我尝试了几个脚本,但它们似乎都不起作用,有人能给我一些见解吗?

非常感谢!!

【问题讨论】:

    标签: php cpanel webmail


    【解决方案1】:

    您需要 Cpanel XML API 类。在这里下载:

    http://sdk.cpanel.net/lib/xmlapi/php/cp_xmlapi_php_v1.0.5.tar.gz

    它带有使用示例,但这可以帮助您入门:

    include('xmlapi.php');
    
    $account = "Cogicero";
    $account_pass = "password";
    $ip = "xxx.xxx.xxx.xxx";
    
    $email_user = "cogicero";
    $email_password = "password";
    $email_domain = "cogicero.com";
    $email_quota = "100";
    
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($account, $account_pass);
    $xmlapi->set_output('xml');
    
    $result = $xmlapi->api1_query($account, "Email", "addpop", array($email_user,   $email_password, $email_quota, $email_domain) );
    

    编辑:如果您需要有关 API 的更多信息,请参阅:http://docs.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/XmlApi

    【讨论】:

    • 谢谢!似乎是我需要的,但是在使用我的信息尝试示例时出现 500 内部服务器错误,关于可能的任何想法?谢谢!
    【解决方案2】:

    This example 应该只将您的访问数据修改为单个文件config.php,您可以通过这种方式轻松创建帐户。 我希望你觉得它有用:

    include_once '../xmlapi.php';
    $xmlapi = new xmlapi(SERVER_IP);
    $xmlapi->password_auth(ROOT_USER,ROOT_PASSWORD);
    $xmlapi->set_debug(1);
    $acct = array( username => "someuser", password => "pass123", domain => "thisdomain.com", plan =>"user_plan_diamond", contactemail=>"user@gmail.com",language=>"es");
    print $xmlapi->createacct($acct);
    

    【讨论】:

      猜你喜欢
      • 2020-10-15
      • 2013-07-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-14
      • 2013-06-29
      • 1970-01-01
      相关资源
      最近更新 更多