[ERROR]Creating email with xmlapi

matheuscl

Registered
Oct 4, 2013
2
0
1
cPanel Access Level
Root Administrator
Hello, i have one script to create emails in cpanel, with reseller account it's ok but in client accounts i have the error:Access denied 0 Access denied.
follow script in resseler account:
<?php
include_once("xmlapi.php");

$account_pass = "secret^^";

$ip = '64.31.16.90';

$account = "secret^^";
$email1 = "testmatheustest";
$email_password = "maisvendas";
$email_domain = "visolutions.com.br";
$email_quota = '0';
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($account, $account_pass);
//$xmlapi->set_port(2083);
$xmlapi->set_output('xml');

echo $xmlapi->api1_query($account, "Email", "addpop", array($email1, $email_password, $email_quota, $email_domain));
?>
and the script for client account(not working):
<?php
include_once("xmlapi.php");

$account_pass = "secret^^";

$ip = '64.31.16.90';

$account = "secret^^";
$email1 = "testmatheustest";
$email_password = "maisvendas";
$email_domain = "boabarganha.com.br";
$email_quota = '0';
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth($account, $account_pass);
//$xmlapi->set_port(2083);
$xmlapi->set_output('xml');

echo $xmlapi->api1_query($account, "Email", "addpop", array($email1, $email_password, $email_quota, $email_domain));
?>
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

I have moved this to the cPanel Developers forum. You should get more input about this topic here.

Thank you.
 

MesinHosting

Member
Mar 25, 2011
13
0
51
use api2_query instead api1_query

PHP:
echo $xmlapi->api2_query($account, "Email", "addpop", array($email1, $email_password, $email_quota, $email_domain));