我想通过php脚本在cpanel中创建电子邮件帐户

时间:2014-11-06 16:22:07

标签: php email cpanel

我想通过php脚本在cpanel中创建电子邮件帐户。我使用以下代码:

<?php
include("xmlapi.php");        //XMLAPI cpanel client class

$ip = "XXX.XX.XXX.XXX";            // should be server IP address or 127.0.0.1 if local server
$account = "XXXXX";        // cpanel user account name
$passwd ="L97$41lw";          // cpanel user password
$port =2083;                  // cpanel secure authentication port unsecure port# 2082
$email_domain ="mywebsite.com";
$email_user ="john";
$email_pass ="johnspassword";
$email_quota = 0;             // 0 is no quota, or set a number in mb

$xmlapi = new xmlapi($ip);
$xmlapi->set_port($port);     //set port number.
$xmlapi->password_auth($account, $passwd);
$xmlapi->set_debug(0);        //output to error file  set to 1 to see error_log.

$call = array(domain=>$email_domain, email=>$email_user, password=>$email_pass, quota=>$email_quota);

$result = $xmlapi->api2_query($account, "Email", "addpop", $call );
echo '123';
echo   $result;
?>

我的xml.api链接是http://mywebsite.com/xmlapi.php。当我执行代码时,没有错误显示也没有获得任何值$ result

0 个答案:

没有答案