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.

simple email account creation script?

Discussion in 'cPanel Developers' started by QuasiNormal, Dec 12, 2010.

  1. QuasiNormal

    QuasiNormal Registered

    Joined:
    Dec 12, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I have tried following a bunch of the guides and none seem to work for me, I also read the documentation and downloaded http://sdk.cpanel.net/examples/frontend_tutorial.tar.gz, which describes how to make a mail account creation page. I don't really follow it and was hoping someone had a working solution for this on servers running WHM 11.28.52 and cPanel Pro 1.0 (RC1) and a notated example.

    Like I said before whenever I try the best i get is a successful email account msg but even though there is no errors no mail account ever gets created.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi QuasiNormal,

    You say you've tried various methods, do you have any example code that we can start with? We could refine it to work for you purposes. That also brings up the question, how are wanting to execute the script? Does it need to be in the cPanel interface or is it on the command line? Please be more specific about your implementation requirements and where you need help.

    Regards,
    -DavidN
     
  3. QuasiNormal

    QuasiNormal Registered

    Joined:
    Dec 12, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1


    I do have a snippet but basically I started with your example I had found in a post of yours in another thread here @cpanel forums. I really don't understand php very well and am very new to it and therefor am having troubles making any usable statements.

    Well here is overall what I am trying to accomplish in a nutshell.

    I just started trying to customize an awesome new forum software called XenForo. What I would like to use this email creation script for when finished, is when a user is promoted to a specific user group on the forum, a button will display in their UserControl panel that says request email which when pushed will use their current user login ID as the email name@mysite.com ( if you did it say here yours would be cPanelDavidN@cpanel.net or something along those lines.) .

    Now I could work the xenforo side of things into it as far as the xenforo user hook and displaying the button to create the mail...but I don't even know where to begin with creating the form. As I said I used your post here and basically I get a blank page once I'm 99% sure I have all the values right ( but I wouldn't know if I was doing anything wrong anyways..) also note that I have cpsessXXXXXXXXX in my cpanel/whm urls and thought it was worth noting that when I try to create an email account using a url string ( I don't even know if that is the proper term followed this post here:) ) I must include the current session id or it will not work and I also include the &post_loginXXXXX but don't know if that is the proper thing to do either. My working one with current session is as follows:
    Code:
    https://cPanelUserAccount:cPanelUserPass@sitesIpAddressOrDomain:sslport/cpsess126*******/frontend/x3/mail/doaddpop.html?email=NewEmailAccountName&domain=MyDomainName.com&password=ExamplePassowrd&post_login=833***********
    This is an example of as much as I have gotten to work at this point and I really haven't a clue what I would need to do to utilize the awesome API calls and I'm sure if I could get a working form to do this that submits and after submitting does not leave the user creating their email the ability to be logged into my cpanel's I say this as the only way I can do this is when logged in and am not sure how I can safely have a user create their own email with php and the api calls?

    I do thank you greatly for taking the time as I really don't know much.

    I can pm you what I have as far as a blank page displaying when I think I have it right but that's all I really have at this point.

    Thank you much...
    -Anthony
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Since XenForo is written in PHP, you might be able to extend it to utilize our XML-API PHP client class. You can get it here. There are examples of how to use in the tarball. I'm not sure if XenForo is compiled (zend optimizer, ioncube, etc) but if not, it should be easy for anyone familiar with PHP to integrate it for your purposes. If you don't have a PHP programmer, then you'll have to probably learn some intermediate PHP in order to accomplish your goal safely and proficiently. Which, by the way, that example post I made in the other thread is reliant on the XML-API PHP client class, so you'll need to include it in your PHP code.

    If you use the PHP client class, you don't have to worry about constructing the URL, it's done for you along with send the request and digesting the response. In that other thread, I just gave the URL to illustrate what the PHP class object was fetching. We don't recommend scripting against the cPanel UI pages, like in your sample URL. Those forms and UI pages are suspect to change without notice and therefore your scripts will be fragile if they depend on them. Also, while WHM & cPanel will take authentication credentials in the URL (as you have in your example) we don't officially support it and thus it's not recommended.

    Have a look at the PHP client class and if you have any specific questions, I'd be glad to answer them.

    Regards,
    -DavidN
     
Loading...

Share This Page