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.

can't get postwwwacct to create e-mail account with php

Discussion in 'E-mail Discussions' started by noimad1, Apr 12, 2010.

  1. noimad1

    noimad1 Well-Known Member

    Joined:
    Mar 27, 2003
    Messages:
    627
    Likes Received:
    0
    Trophy Points:
    16
    So here is the script I'm trying to run inside /scripts/postwwwacct:

    PHP:

    #!/usr/local/bin/php -q
    <?php
    include('xmlapi.php');

    $opts = array();
    $argv0 array_shift($argv);
    while(
    count($argv)) {
    $key array_shift($argv);
    $value array_shift($argv);
    $opts[$key] = $value;
    }


    $account $opts['user'];
    $email_domain $opts['domain'];

    $email_user "emailaddress1";
    $email_password "emailaccountpass";
    $email_quota '110';


    $ip "xxx.xxx.xxx.xxx";
    $root_pass "mypassword";
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root",$root_pass);
    $xmlapi->set_output('xml');

    $result $xmlapi->api1_query($account"Email""addpop", array($email_user$email_password$email_quota$email_domain) );

    ?>

    And I'm using the sample xmlapi.php code provided by cpanel. If I change $account to a manual account name it seems to work ok. However, the way it stands now no e-mail account is created? So I'm thinking the opts array maybe isn't getting set, but of course I haven't found a way to debug any output when actually creating the account through the WHM, because it just says "running /scripts/postwwwacct" but doesn't give any output.

    Does anyone see anything wrong or missing with this script?
     
Loading...

Share This Page