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.

Email Account Registration without cpanel login!

Discussion in 'E-mail Discussions' started by taya9taya10, Oct 3, 2004.

  1. taya9taya10

    taya9taya10 Registered

    Joined:
    Oct 3, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Is there any one can help PHP Script to register email account without cpanel login?
    I tried this PHP scripts. I can use only one day. That scripts doesn't work on next day :(
    Who can help me?????? :)
    <?
    if ($submit){
    $host = "CPanel IP";
    $port = 2083;
    $path = "/frontend/rvblue/mail/doaddpop.html";


    $cpaneluser = "user name";
    $cpanelpass = "cpanel password";
    $authstr = "$cpaneluser:$cpanelpass";
    //****************************


    $pass = base64_encode($authstr);


    $formdata = array ( "email" => $email, "domain" => $host, "password" => $password, "quota" => $quota);

    foreach($formdata AS $key => $val){
    $poststring .= urlencode($key) . "=" . urlencode($val) . "&";
    }

    $poststring = substr($poststring, 0, -1);

    $fp = fsockopen($host, $port, $errno, $errstr, $timeout = 30);

    if(!$fp){

    echo "$errstr ($errno)\n";

    }else{



    fputs($fp, "POST $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    fputs($fp, "Authorization: Basic $pass \r\n");
    fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
    fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
    fputs($fp, "Connection: close\r\n\r\n");
    fputs($fp, $poststring . "\r\n\r\n");

    fclose($fp);
    }
    print "Account Created";
    }else{

    ?>
    <form method="post">
    Username:<input type="text" name="email"><br>
    Password:<input type="password" name="password"><br>
    Quota:<input type="text" name="quota">
    <input type="submit" name="submit" value="true">
    <? } ?>
     
  2. memooney

    memooney Registered

    Joined:
    Oct 5, 2004
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Looking for something similar.

    I'm looking for something similar. I want ot have user use their cPanel created email/passwords to login to a web portal. This would allow them to use one login/pswd rather than storing a new login/password in a database.

    It sounds like we are both looking for similar things.

    Matt
     
  3. peter524

    peter524 Registered

    Joined:
    Sep 12, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I'm looking also. I hope someone will answer our question..
     
  4. jhohorst

    jhohorst Registered

    Joined:
    Nov 2, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Creating Mail Accounts Through cPanel with PHP

    Try this:

    $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$account&domain=$domain&password=$password&quota=$quota", "r");
    if (!$f) {
    return FALSE;
    } else {
    while (!feof ($f)) {
    $line = fgets ($f, 1024);
    if (ereg ("already exists", $line, $out)) {
    return $line;
    break();
    }
    }
    fclose($f);
    }
    retrun TRUE;

    Where $cpuser, $cppass, $cpdomain relate to your cPanel account, and $cpskin is the skin you use (usually 'x' or 'x2' - check your URL), and $account, $domain, $password and $quota specify the account you want to create (e,g, $account='yourname', $domain='yourdomain.com' to create the address 'yourname@yourdomain.com'). The quota is in megs, 10 or 20 are usual numbers.
     
Loading...

Share This Page