The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php script to create email account is not working

Discussion in 'cPanel Developers' started by ctello, Jul 30, 2011.

  1. ctello

    ctello Registered

    Joined:
    Jul 30, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I am using the following scrip and the return value is "0 access denied"
    How can I make this work? I got cpanel 11.30.1 (build 4)
    I am desperately in need of help!:confused:

    here is the script:

    <?php
    include 'xmlapi.php';
    $ip = "111.111.111.111";
    $account = "my_cpanel_account_name";
    $account_pass = "my_cpanel_account_password";

    $email_user = "test";
    $email_password = "a11111";
    $email_domain = "mydomainname.com";
    $email_quota = '100';

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($account, $account_pass); /*<-- USE USER ACCOUNT AUTH*/
    $xmlapi->set_output('xml');

    $result = $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_quota, $email_domain) );
    echo "outcome =".$result;
    ?>
     
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Before you execute api1_query, execute set_port(2083);

    What you are doing is calling port 2087, which will deny authentication.
     
Loading...

Share This Page