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.

automatic email account creation help

Discussion in 'E-mail Discussions' started by princeshoko, May 21, 2007.

  1. princeshoko

    princeshoko Member

    Joined:
    Jun 8, 2004
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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. visiox

    visiox Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    PHP:
    <? 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. princeshoko

    princeshoko Member

    Joined:
    Jun 8, 2004
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    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. visiox

    visiox Well-Known Member

    Joined:
    Jan 19, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    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. princeshoko

    princeshoko Member

    Joined:
    Jun 8, 2004
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    time to brush up on my php it looks like. Thanks for the nudge.
     
  6. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    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. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  8. Phil1019

    Phil1019 Registered

    Joined:
    Jul 10, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi mate,

    Use this ammended function I made just for the same purpose

    PHP:
    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. Webou

    Webou Member

    Joined:
    Jun 6, 2007
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
Loading...

Share This Page