Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jun 2004
    Posts
    12

    Default automatic email account creation help

    Is there a way to auto create an email account within cpanel like hotmail/gmail does with a php script?

    I did a search on these forums found many links, all but one dead and it wanted $99. Looking for a free script.

    Thanks
    PrinceShoko

  2. #2
    Member
    Join Date
    Jan 2004
    Posts
    49

    Default

    PHP Code:
    <? require '/usr/local/Cpanel/Accounting.php.inc';
    $host "localhost";
    $user "root";(or you username)
    $accesshash ='(insert your access hash here)';
    createacct ($host,$user,$accesshash,$usessl,$domain,$username,$password,$package) ;
    ?>

  3. #3
    Member
    Join Date
    Jun 2004
    Posts
    12

    Default

    That looks like a script used to create a hosting account right?

    Im looking to auto create email accounts inside an already existing cpanel account with a php submit page.

    Or am i misunderstanding the code here?

  4. #4
    Member
    Join Date
    Jan 2004
    Posts
    49

    Default

    Yep, this peace of script is creating a new hosting account.

    But!... if you now take a look into /usr/local/cpanel/Cpanel/Accounting.php.inc you see how easy it is to add new functions into the script.

  5. #5
    Member
    Join Date
    Jun 2004
    Posts
    12

    Default

    time to brush up on my php it looks like. Thanks for the nudge.

  6. #6
    Member
    Join Date
    Jun 2007
    Posts
    22

    Default

    Quote Originally Posted by visiox View Post
    PHP Code:
    <? require '/usr/local/Cpanel/Accounting.php.inc';
    $host "localhost";
    $user "root";(or you username)
    $accesshash ='(insert your access hash here)';
    createacct ($host,$user,$accesshash,$usessl,$domain,$username,$password,$package) ;
    ?>
    Hello,

    I'm using this script, which works fine, but I'd like to link the email address also.

    How should I do that?

    Thanks in advance,
    Michael

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    I would recommend using the XML API because it offers greater flexibility. You can find the XML API documentation at:

    http://www.cpanel.net/plugins/xmlapi/index.html

    The cool thing with the XML API is you can call API2 functions from it as well. For a list of additional functionality available via API2, refer to the API2 documentation at:

    http://www.cpanel.net/plugins/api2/index.html

  8. #8
    Registered User
    Join Date
    Jul 2006
    Posts
    2

    Default

    Quote Originally Posted by Webou View Post
    Hello,

    I'm using this script, which works fine, but I'd like to link the email address also.

    How should I do that?

    Thanks in advance,
    Michael
    Hi mate,

    Use this ammended function I made just for the same purpose

    PHP Code:
    function createacct ($host,$user,$accesshash,$usessl,$acctdomain,$acctuser,$acctpass,$acctemail,$acctplan) {
        
    $result whmreq("/scripts/wwwacct?remote=1&nohtml=1&contactemail=${acctemail}&username=${acctuser}&password=${acctpass}&domain=${acctdomain}&plan=${acctplan}",$host,$user,$accesshash,$usessl);
        if (
    $cpanelaccterr != "") { return; }
        return 
    $result;


  9. #9
    Member
    Join Date
    Jun 2007
    Posts
    22

    Default

    Thank you david and Phil.

    By now, I'll use phil's function, and I'll begin to adapt my system to the new api soon.

Similar Threads & Tags
Similar threads

  1. Automatic Account Creation....AGAIN.
    By JSellnau in forum New User Questions
    Replies: 3
    Last Post: 06-07-2005, 11:22 AM
  2. Automatic email account creation
    By ernet in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 05-30-2005, 06:23 PM
  3. Automatic account creation? is there a way?
    By wonderboy in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-11-2003, 06:41 PM
  4. automatic account-creation
    By strauberry in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-28-2003, 04:45 PM
  5. Automatic Account Creation
    By bdraco in forum cPanel and WHM Discussions
    Replies: 28
    Last Post: 05-13-2002, 01:54 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube